Skip to content

Commit c0f7923

Browse files
committed
Add tests that cover backslashes in raw strings
The official grammar does not allow backslashes in raw strings except when followed by single quote, however there are compliance tests that require backslashes to be treated as any other character, and jp seem to work that way.
1 parent 7115be1 commit c0f7923

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/literal.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,16 @@
184184
"comment": "Can escape the single quote",
185185
"expression": "'foo\\'bar'",
186186
"result": "foo'bar"
187+
},
188+
{
189+
"comment": "Backslash not followed by single quote is treated as any other character",
190+
"expression": "'\\z'",
191+
"result": "\\z"
192+
},
193+
{
194+
"comment": "Backslash not followed by single quote is treated as any other character",
195+
"expression": "'\\\\'",
196+
"result": "\\\\"
187197
}
188198
]
189199
}

0 commit comments

Comments
 (0)