@@ -346,19 +346,19 @@ testcases = [
346
346
(" \" \" " , InlineString7 (" " ), NamedTuple (), OK | QUOTED | EOF), # quoted
347
347
(" NA" , InlineString7 (), (; sentinel= [" NA" ]), EOF | SENTINEL), # sentinel
348
348
(" \"\" " , InlineString7 (), NamedTuple (), OK | QUOTED | EOF), # same e & cq
349
- (" \"\" ," , InlineString7 (), NamedTuple (), OK | QUOTED | EOF | DELIMITED), # same e & cq
349
+ (" \"\" ," , InlineString7 (), NamedTuple (), OK | QUOTED | DELIMITED), # same e & cq
350
350
(" \"\"\"\" " , InlineString7 (" \" " ), NamedTuple (), OK | QUOTED | ESCAPED_STRING | EOF), # same e & cq
351
- (" \"\\ " , InlineString7 (), (; escapechar= UInt8 (' \\ ' )), OK | QUOTED | INVALID_QUOTED_FIELD | EOF), # \\ e, invalid quoted
351
+ (" \"\\ " , InlineString7 (), (; escapechar= UInt8 (' \\ ' )), OK | QUOTED | ESCAPED_STRING | INVALID_QUOTED_FIELD | EOF), # \\ e, invalid quoted
352
352
(" \"\\\"\" " , InlineString7 (" \" " ), (; escapechar= UInt8 (' \\ ' )), OK | QUOTED | ESCAPED_STRING | EOF), # \\ e, valid
353
353
(" \"\" " , InlineString7 (), (; escapechar= UInt8 (' \\ ' )), OK | QUOTED | EOF), # diff e & cq
354
- (" \" a" , InlineString7 (), NamedTuple (), OK | QUOTED | INVALID_QUOTED_FIELD | EOF), # invalid quoted
354
+ (" \" a" , InlineString7 (" a " ), NamedTuple (), OK | QUOTED | INVALID_QUOTED_FIELD | EOF), # invalid quoted
355
355
(" \" a\" " , InlineString7 (" a" ), NamedTuple (), OK | QUOTED | EOF), # quoted
356
356
(" \" a\" " , InlineString7 (" a" ), NamedTuple (), OK | QUOTED | EOF), # quoted
357
- (" \" a\" ," , InlineString7 (" a" ), NamedTuple (), OK | QUOTED | EOF | DELIMITED), # quoted
358
- (" a," , InlineString7 (" a" ), NamedTuple (), OK | EOF | DELIMITED),
359
- (" a__" , InlineString7 (" a" ), (; delim= " __" ), OK | EOF | DELIMITED),
360
- (" a," , InlineString7 (" a" ), (; ignorerepeated= true ), OK | EOF | DELIMITED),
361
- (" a__" , InlineString7 (" a" ), (; delim= " __" , ignorerepeated= true ), OK | EOF | DELIMITED),
357
+ (" \" a\" ," , InlineString7 (" a" ), NamedTuple (), OK | QUOTED | DELIMITED), # quoted
358
+ (" a," , InlineString7 (" a" ), NamedTuple (), OK | DELIMITED),
359
+ (" a__" , InlineString7 (" a" ), (; delim= " __" ), OK | DELIMITED),
360
+ (" a," , InlineString7 (" a" ), (; ignorerepeated= true ), OK | DELIMITED),
361
+ (" a__" , InlineString7 (" a" ), (; delim= " __" , ignorerepeated= true ), OK | DELIMITED),
362
362
(" a\n " , InlineString7 (" a" ), (; ignorerepeated= true ), OK | NEWLINE | EOF),
363
363
(" a\r " , InlineString7 (" a" ), (; ignorerepeated= true ), OK | NEWLINE | EOF),
364
364
(" a\r\n " , InlineString7 (" a" ), (; ignorerepeated= true ), OK | NEWLINE | EOF),
@@ -381,8 +381,20 @@ for (i, case) in enumerate(testcases)
381
381
println (" testing case = $i " )
382
382
buf, check, opts, checkcode = case
383
383
res = Parsers. xparse (InlineString7, buf; opts... )
384
- @test check === res. val
385
- @test checkcode == res. code
384
+ # in Parsers.jl pre-v2.5, we failed to include the string value on INVALID
385
+ @test check === res. val || (i == 14 && res. val === InlineString7 (" " ))
386
+ if Parsers. ok (checkcode) && Parsers. delimited (checkcode) && ! Parsers. newline (checkcode)
387
+ # due to a Parsers.jl bug in pre-v2.5, String parsing inaccurately included the
388
+ # EOF code when it shouldn't have; so we allow either in our tests.
389
+ code = res. code & ~ EOF
390
+ elseif i == 11
391
+ # due to a Parsers.jl bug in pre-v2.5, String parsing failed to include the
392
+ # ESCAPED_STRING code when it should have
393
+ code = res. code | ESCAPED_STRING
394
+ else
395
+ code = res. code
396
+ end
397
+ @test checkcode == code
386
398
end
387
399
388
400
res = Parsers. xparse (InlineString1, " " )
0 commit comments