File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,16 @@ test.snapshot({
34
34
String . raw `import {} from "foo" with {"key\\key": "value"}` ,
35
35
String . raw `export {} from "foo" with {key: "value\\value"}` ,
36
36
String . raw `export {} from "foo" with {"key\\key": "value"}` ,
37
+ String . raw `a = '\\'` ,
38
+ String . raw `a = 'a\\b\"'` ,
37
39
] ,
38
40
invalid : [
39
41
String . raw `a = 'a\\b'` ,
40
42
String . raw `a = {['a\\b']: b}` ,
41
43
String . raw `function a() {return'a\\b'}` ,
42
44
String . raw `const foo = "foo \\x46";` ,
45
+ String . raw `a = 'a\\b\''` ,
46
+ String . raw `a = "a\\b\""` ,
43
47
] ,
44
48
} ) ;
45
49
Original file line number Diff line number Diff line change @@ -87,3 +87,45 @@ Generated by [AVA](https://avajs.dev).
87
87
> 1 | const foo = "foo \\\\x46";␊
88
88
| ^^^^^^^^^^^ \`String.raw\` should be used to avoid escaping \`\\\`.␊
89
89
`
90
+
91
+ ## invalid(5): a = 'a\\ b\' '
92
+
93
+ > Input
94
+
95
+ `␊
96
+ 1 | a = 'a\\\\b\\''␊
97
+ `
98
+
99
+ > Output
100
+
101
+ `␊
102
+ 1 | a = String.raw\`a\\b'\`␊
103
+ `
104
+
105
+ > Error 1/1
106
+
107
+ `␊
108
+ > 1 | a = 'a\\\\b\\''␊
109
+ | ^^^^^^^^ \`String.raw\` should be used to avoid escaping \`\\\`.␊
110
+ `
111
+
112
+ ## invalid(6): a = "a\\ b\" "
113
+
114
+ > Input
115
+
116
+ `␊
117
+ 1 | a = "a\\\\b\\""␊
118
+ `
119
+
120
+ > Output
121
+
122
+ `␊
123
+ 1 | a = String.raw\`a\\b"\`␊
124
+ `
125
+
126
+ > Error 1/1
127
+
128
+ `␊
129
+ > 1 | a = "a\\\\b\\""␊
130
+ | ^^^^^^^^ \`String.raw\` should be used to avoid escaping \`\\\`.␊
131
+ `
You can’t perform that action at this time.
0 commit comments