Skip to content

Commit a72253a

Browse files
committed
refactor: add variation in test cases
1 parent ce72f0d commit a72253a

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

test/prefer-string-raw.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ test.snapshot({
7171
],
7272
invalid: [
7373
'a = `a\\\\b`',
74-
'a = `a\\\\b${foo}cd`',
75-
'a = `a\\\\b${foo}cd${foo.bar}e\\\\f`',
74+
'function a() {return `a\\\\b${foo}cd`}',
75+
'a = {[`a\\\\b${foo}cd${foo.bar}e\\\\f`]: b}',
7676
'a = `a${foo}${foo.bar}b\\\\c`',
7777
'a = `a\\\\b${"c\\\\d"}e`',
7878
],

test/snapshots/prefer-string-raw.js.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,46 +109,46 @@ Generated by [AVA](https://avajs.dev).
109109
| ^^^^^^ \`String.raw\` should be used to avoid escaping \`\\\`.␊
110110
`
111111

112-
## invalid(2): a = `a\\b${foo}cd`
112+
## invalid(2): function a() {return `a\\b${foo}cd`}
113113

114114
> Input
115115
116116
`␊
117-
1 | a = \`a\\\\b${foo}cd\`␊
117+
1 | function a() {return \`a\\\\b${foo}cd\`}
118118
`
119119

120120
> Output
121121
122122
`␊
123-
1 | a = String.raw\`a\\b${foo}cd\`␊
123+
1 | function a() {return String.raw\`a\\b${foo}cd\`}
124124
`
125125

126126
> Error 1/1
127127
128128
`␊
129-
> 1 | a = \`a\\\\b${foo}cd\`␊
130-
| ^^^^^^^^^^^^^^ \`String.raw\` should be used to avoid escaping \`\\\`.␊
129+
> 1 | function a() {return \`a\\\\b${foo}cd\`}
130+
| ^^^^^^^^^^^^^^ \`String.raw\` should be used to avoid escaping \`\\\`.␊
131131
`
132132

133-
## invalid(3): a = `a\\b${foo}cd${foo.bar}e\\f`
133+
## invalid(3): a = {[`a\\b${foo}cd${foo.bar}e\\f`]: b}
134134

135135
> Input
136136
137137
`␊
138-
1 | a = \`a\\\\b${foo}cd${foo.bar}e\\\\f\`␊
138+
1 | a = {[\`a\\\\b${foo}cd${foo.bar}e\\\\f\`]: b}
139139
`
140140

141141
> Output
142142
143143
`␊
144-
1 | a = String.raw\`a\\b${foo}cd${foo.bar}e\\f\`␊
144+
1 | a = {[String.raw\`a\\b${foo}cd${foo.bar}e\\f\`]: b}
145145
`
146146

147147
> Error 1/1
148148
149149
`␊
150-
> 1 | a = \`a\\\\b${foo}cd${foo.bar}e\\\\f\`␊
151-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \`String.raw\` should be used to avoid escaping \`\\\`.␊
150+
> 1 | a = {[\`a\\\\b${foo}cd${foo.bar}e\\\\f\`]: b}
151+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \`String.raw\` should be used to avoid escaping \`\\\`.␊
152152
`
153153

154154
## invalid(4): a = `a${foo}${foo.bar}b\\c`
26 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)