Skip to content

Commit 519ecda

Browse files
committed
Add more tests around c-string escapes.
1 parent cfe4093 commit 519ecda

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/syntax-rust/syntax_test_literals.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,16 @@ let cstr_empty = c"";
175175
let cstr_unicode = c"æ";
176176
// ^ string.quoted.double storage.type.string
177177
// ^^^^ string.quoted.double
178-
let cstr_byte_escape = c"\xFF\xC3\xA6";
178+
let cstr_byte_escape = c"\xFF\xC3\xA6\n\r\t\0\"\'\\";
179179
// ^ storage.type.string
180-
// ^^^^^^^^^^^^^^^ string.quoted.double
181-
// ^^^^^^^^^^^^ constant.character.escape
180+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double
181+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape
182+
let cstr_byte_escape_invalid = c"\a";
183+
// ^^^^^ string.quoted.double
184+
// ^ storage.type.string
185+
// ^ punctuation.definition.string.begin
186+
// ^^ invalid.illegal.character.escape
187+
// ^ punctuation.definition.string.end
182188
let cstr_unicode_escape = c"\u{00E6}";
183189
// ^^^^^^^^^^^ string.quoted.double
184190
// ^^^^^^^^ constant.character.escape
@@ -205,6 +211,9 @@ let raw_cstr_multiline = cr##"
205211
This text has "multiple lines"
206212
"##;
207213
// ^^ string.quoted.double.raw punctuation.definition.string.end
214+
let raw_cstr_escape_ignore = cr"\n\x01\u{0123}\";
215+
// ^^^^^^^^^^^^^^^^^^^ string.quoted.double.raw
216+
// ^^^^^^^^^^^^^^^ -constant.character.escape
208217

209218
0;
210219
// <- constant.numeric.integer.decimal

0 commit comments

Comments
 (0)