@@ -196,17 +196,75 @@ test('retextQuotes', async function (t) {
196
196
}
197
197
)
198
198
199
- await t . test ( 'should detect nesting correctly w/ 3 pairs ' , async function ( ) {
199
+ await t . test ( 'should detect nesting correctly w/ 1 pair ' , async function ( ) {
200
200
const file = await retext ( )
201
- . use ( retextQuotes , { smart : [ '“”' , '‘’' , '«»' ] } )
202
- . process ( 'A sentence “with ‘multiple «nested “quotes”»’”.' )
201
+ . use ( retextQuotes , { smart : [ '“”' ] } )
202
+ . process (
203
+ `A sentence with “quotes”.
204
+
205
+ A sentence with “nested “quotes””.
206
+
207
+ A sentence with “multiple “nested “quotes”””.
208
+
209
+ Mismatched closing” quotes.
210
+
211
+ Mismatched closing’ quotes.
212
+
213
+ Mismatched “opening quotes.
214
+
215
+ Mismatched ‘opening quotes.
216
+ `
217
+ )
203
218
204
219
assert . deepEqual ( file . messages . map ( String ) , [ ] )
205
220
} )
206
221
222
+ await t . test ( 'should detect nesting correctly w/ 2 pairs' , async function ( ) {
223
+ const file = await retext ( ) . use ( retextQuotes , { smart : [ '“”' , '‘’' ] } )
224
+ . process ( `A sentence with “quotes”.
225
+
226
+ A sentence with “nested ‘quotes’”.
227
+
228
+ A sentence with “multiple ‘nested “quotes”’”.
229
+
230
+ Mismatched closing” quotes.
231
+
232
+ Mismatched closing’ quotes.
233
+
234
+ Mismatched “opening quotes.
235
+
236
+ Mismatched ‘opening quotes.
237
+ ` )
238
+
239
+ assert . deepEqual ( file . messages . map ( String ) , [
240
+ '13:12-13:13: Unexpected `‘` at this level of nesting, expected `“`'
241
+ ] )
242
+ } )
243
+
244
+ await t . test ( 'should detect nesting correctly w/ 3 pairs' , async function ( ) {
245
+ const file = await retext ( ) . use ( retextQuotes , { smart : [ '“”' , '‘’' , '«»' ] } )
246
+ . process ( `A sentence with “quotes”.
247
+
248
+ A sentence with “nested ‘quotes’”.
249
+
250
+ A sentence with “multiple ‘nested «quotes»’”.
251
+
252
+ Mismatched closing” quotes.
253
+
254
+ Mismatched closing’ quotes.
255
+
256
+ Mismatched “opening quotes.
257
+
258
+ Mismatched ‘opening quotes.
259
+ ` )
260
+
261
+ assert . deepEqual ( file . messages . map ( String ) , [
262
+ '13:12-13:13: Unexpected `‘` at this level of nesting, expected `“`'
263
+ ] )
264
+ } )
265
+
207
266
await t . test ( 'should deal with funky nesting' , async function ( ) {
208
267
const file = await retext ( ) . use ( retextQuotes ) . process ( soManyOpenings )
209
-
210
268
assert . deepEqual ( file . messages . map ( String ) , [ ] )
211
269
} )
212
270
0 commit comments