Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InlineStrings.jl tests fail on Parsers.jl main #140

Closed
nickrobinson251 opened this issue Oct 21, 2022 · 3 comments
Closed

InlineStrings.jl tests fail on Parsers.jl main #140

nickrobinson251 opened this issue Oct 21, 2022 · 3 comments

Comments

@nickrobinson251
Copy link
Collaborator

nickrobinson251 commented Oct 21, 2022

Using the unreleased version of Parsers.jl post-#127 the following test cases from InlineStrings.jl fail (these are cut down from the InlineStrings.jl tests, to see the failures in the context of the full testset see https://github.com/JuliaData/Parsers.jl/actions/runs/3300589688/jobs/5445241946).

I think the first of these might be considered a bug in Parsers.jl, the rest i really don't know. they may all be fine, but i think worth reviewing before we make a new release (to decide if it should be marked breaking and/or how to update InlineStrings.jl)

# test/fails.jl

using InlineStrings, Test, Parsers
using Parsers: SENTINEL, OK, EOF, OVERFLOW, QUOTED, DELIMITED, INVALID_DELIMITER, INVALID_QUOTED_FIELD, ESCAPED_STRING, NEWLINE, SUCCESS

@testset begin
    testcases = [
       # Failure due to parsing to a different value!
      ("\"a", InlineString7(), NamedTuple(), OK | QUOTED | INVALID_QUOTED_FIELD | EOF), # invalid quoted
      
      # Failure due to added ESCAPED_STRING code
      ("\"\\", InlineString7(), (; escapechar=UInt8('\\')), OK | QUOTED | INVALID_QUOTED_FIELD | EOF), # \\ e, invalid quoted
      
      # Failure due to added OK code
      ("NA", InlineString7(), (; sentinel=["NA"]), EOF | SENTINEL), # sentinel
            
      # Failures due to no EOF code
      ("\"\",", InlineString7(), NamedTuple(), OK | QUOTED | EOF | DELIMITED), # same e & cq
      ("\"a\",", InlineString7("a"), NamedTuple(), OK | QUOTED | EOF | DELIMITED), # quoted
      ("a,", InlineString7("a"), NamedTuple(), OK | EOF | DELIMITED),
      ("a__", InlineString7("a"), (; delim="__"), OK | EOF | DELIMITED),
      ("a,", InlineString7("a"), (; ignorerepeated=true), OK | EOF | DELIMITED),
      ("a__", InlineString7("a"), (; delim="__", ignorerepeated=true), OK | EOF | DELIMITED),
  ]
    for (i, case) in enumerate(testcases)
        println("\n---")
        println("testing case = $i")
        buf, check, opts, checkcode = case
        res = Parsers.xparse(InlineString7, buf; opts...)
        @show buf

        if !(check== res.val)
            @show check
            @show res.val
        end
        @test check === res.val

        if !(checkcode == res.code)
            @show Parsers.codes(checkcode)
            @show Parsers.codes(res.code)
        end
        @test checkcode == res.code
    end
end
julia> include("test/fails.jl")

---
testing case = 1
buf = "\"a"
check = ""
res.val = "a"
test set: Test Failed at /Users/nickr/repos/InlineStrings.jl/test/fails.jl:34
  Expression: check === res.val
   Evaluated: "" === "a"
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
 [2] macro expansion
   @ ~/repos/InlineStrings.jl/test/fails.jl:34 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
 [4] top-level scope
   @ ~/repos/InlineStrings.jl/test/fails.jl:7

---
testing case = 2
buf = "\"\\"
Parsers.codes(checkcode) = "INVALID: OK | QUOTED | EOF | INVALID_QUOTED_FIELD "
Parsers.codes(res.code) = "INVALID: OK | QUOTED | ESCAPED_STRING | EOF | INVALID_QUOTED_FIELD "
test set: Test Failed at /Users/nickr/repos/InlineStrings.jl/test/fails.jl:40
  Expression: checkcode == res.code
   Evaluated: -32667 == -32155
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
 [2] macro expansion
   @ ~/repos/InlineStrings.jl/test/fails.jl:40 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
 [4] top-level scope
   @ ~/repos/InlineStrings.jl/test/fails.jl:7

---
testing case = 3
buf = "NA"
Parsers.codes(checkcode) = "SUCCESS: SENTINEL | EOF "
Parsers.codes(res.code) = "SUCCESS: OK | SENTINEL | EOF "
test set: Test Failed at /Users/nickr/repos/InlineStrings.jl/test/fails.jl:40
  Expression: checkcode == res.code
   Evaluated: 34 == 35
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
 [2] macro expansion
   @ ~/repos/InlineStrings.jl/test/fails.jl:40 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
 [4] top-level scope
   @ ~/repos/InlineStrings.jl/test/fails.jl:7

---
testing case = 4
buf = "\"\","
Parsers.codes(checkcode) = "SUCCESS: OK | QUOTED | DELIMITED | EOF "
Parsers.codes(res.code) = "SUCCESS: OK | QUOTED | DELIMITED "
test set: Test Failed at /Users/nickr/repos/InlineStrings.jl/test/fails.jl:40
  Expression: checkcode == res.code
   Evaluated: 45 == 13
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
 [2] macro expansion
   @ ~/repos/InlineStrings.jl/test/fails.jl:40 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
 [4] top-level scope
   @ ~/repos/InlineStrings.jl/test/fails.jl:7

---
testing case = 5
buf = "\"a\","
Parsers.codes(checkcode) = "SUCCESS: OK | QUOTED | DELIMITED | EOF "
Parsers.codes(res.code) = "SUCCESS: OK | QUOTED | DELIMITED "
test set: Test Failed at /Users/nickr/repos/InlineStrings.jl/test/fails.jl:40
  Expression: checkcode == res.code
   Evaluated: 45 == 13
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
 [2] macro expansion
   @ ~/repos/InlineStrings.jl/test/fails.jl:40 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
 [4] top-level scope
   @ ~/repos/InlineStrings.jl/test/fails.jl:7

---
testing case = 6
buf = "a,"
Parsers.codes(checkcode) = "SUCCESS: OK | DELIMITED | EOF "
Parsers.codes(res.code) = "SUCCESS: OK | DELIMITED "
test set: Test Failed at /Users/nickr/repos/InlineStrings.jl/test/fails.jl:40
  Expression: checkcode == res.code
   Evaluated: 41 == 9
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
 [2] macro expansion
   @ ~/repos/InlineStrings.jl/test/fails.jl:40 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
 [4] top-level scope
   @ ~/repos/InlineStrings.jl/test/fails.jl:7

---
testing case = 7
buf = "a__"
Parsers.codes(checkcode) = "SUCCESS: OK | DELIMITED | EOF "
Parsers.codes(res.code) = "SUCCESS: OK | DELIMITED "
test set: Test Failed at /Users/nickr/repos/InlineStrings.jl/test/fails.jl:40
  Expression: checkcode == res.code
   Evaluated: 41 == 9
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
 [2] macro expansion
   @ ~/repos/InlineStrings.jl/test/fails.jl:40 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
 [4] top-level scope
   @ ~/repos/InlineStrings.jl/test/fails.jl:7

---
testing case = 8
buf = "a,"
Parsers.codes(checkcode) = "SUCCESS: OK | DELIMITED | EOF "
Parsers.codes(res.code) = "SUCCESS: OK | DELIMITED "
test set: Test Failed at /Users/nickr/repos/InlineStrings.jl/test/fails.jl:40
  Expression: checkcode == res.code
   Evaluated: 41 == 9
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
 [2] macro expansion
   @ ~/repos/InlineStrings.jl/test/fails.jl:40 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
 [4] top-level scope
   @ ~/repos/InlineStrings.jl/test/fails.jl:7

---
testing case = 9
buf = "a__"
Parsers.codes(checkcode) = "SUCCESS: OK | DELIMITED | EOF "
Parsers.codes(res.code) = "SUCCESS: OK | DELIMITED "
test set: Test Failed at /Users/nickr/repos/InlineStrings.jl/test/fails.jl:40
  Expression: checkcode == res.code
   Evaluated: 41 == 9
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
 [2] macro expansion
   @ ~/repos/InlineStrings.jl/test/fails.jl:40 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
 [4] top-level scope
   @ ~/repos/InlineStrings.jl/test/fails.jl:7
Test Summary: | Pass  Fail  Total  Time
test set      |    9     9     18  0.0s
ERROR: LoadError: Some tests did not pass: 9 passed, 9 failed, 0 errored, 0 broken.
in expression starting at /Users/nickr/repos/InlineStrings.jl/test/fails.jl:6
@nickrobinson251
Copy link
Collaborator Author

#142 will fix test case 3 above

      # Failure due to added OK code
      ("NA", InlineString7(), (; sentinel=["NA"]), EOF | SENTINEL), # sentinel

@nickrobinson251
Copy link
Collaborator Author

changes to InlineStrings.jl being discussed at JuliaStrings/InlineStrings.jl#54

At least some of the failures listed above are actually due to bug-fixes

@quinnj
Copy link
Member

quinnj commented Nov 1, 2022

Resolved

@quinnj quinnj closed this as completed Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants