Skip to content

Commit f1fa84c

Browse files
committed
Add test for proc_macro Literal string and character constructors
1 parent 1fca19c commit f1fa84c

File tree

1 file changed

+11
-0
lines changed
  • src/test/ui/proc-macro/auxiliary/api

1 file changed

+11
-0
lines changed

src/test/ui/proc-macro/auxiliary/api/parse.rs

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ fn test_display_literal() {
1818
Literal::f64_unsuffixed(1e100).to_string(),
1919
"10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0",
2020
);
21+
22+
assert_eq!(
23+
Literal::string("a \t ❤ ' \" \u{1}").to_string(),
24+
"\"a \\t ❤ \\' \\\" \\u{1}\"",
25+
);
26+
assert_eq!(Literal::character('a').to_string(), "'\\u{61}'");
27+
assert_eq!(Literal::character('\t').to_string(), "'\\u{9}'");
28+
assert_eq!(Literal::character('❤').to_string(), "'\\u{2764}'");
29+
assert_eq!(Literal::character('\'').to_string(), "'\\u{27}'");
30+
assert_eq!(Literal::character('"').to_string(), "'\\u{22}'");
31+
assert_eq!(Literal::character('\u{1}').to_string(), "'\\u{1}'");
2132
}
2233

2334
fn test_parse_literal() {

0 commit comments

Comments
 (0)