Skip to content

Commit

Permalink
Add more tests around c-string escapes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Dec 5, 2023
1 parent 5aeab71 commit 1ceba0f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Rust/tests/syntax_test_literals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,16 @@ let cstr_empty = c"";
let cstr_unicode = c"æ";
// ^ string.quoted.double storage.type.string
// ^^^^ string.quoted.double
let cstr_byte_escape = c"\xFF\xC3\xA6";
let cstr_byte_escape = c"\xFF\xC3\xA6\n\r\t\0\"\'\\";
// ^ storage.type.string
// ^^^^^^^^^^^^^^^ string.quoted.double
// ^^^^^^^^^^^^ constant.character.escape
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double
// ^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape
let cstr_byte_escape_invalid = c"\a";
// ^^^^^ string.quoted.double
// ^ storage.type.string
// ^ punctuation.definition.string.begin
// ^^ invalid.illegal.character.escape
// ^ punctuation.definition.string.end
let cstr_unicode_escape = c"\u{00E6}";
// ^^^^^^^^^^^ string.quoted.double
// ^^^^^^^^ constant.character.escape
Expand All @@ -205,6 +211,9 @@ let raw_cstr_multiline = cr##"
This text has "multiple lines"
"##;
// ^^ string.quoted.double.raw punctuation.definition.string.end
let raw_cstr_escape_ignore = cr"\n\x01\u{0123}\";
// ^^^^^^^^^^^^^^^^^^^ string.quoted.double.raw
// ^^^^^^^^^^^^^^^ -constant.character.escape

0;
// <- constant.numeric.integer.decimal
Expand Down

0 comments on commit 1ceba0f

Please sign in to comment.