File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ def debug_token_value(token_name)
89
89
"..."
90
90
elsif token_name == :STRING
91
91
string_value
92
+ elsif @scanner . matched_size . nil?
93
+ @scanner . peek ( 1 )
92
94
else
93
95
token_value
94
96
end
Original file line number Diff line number Diff line change @@ -739,13 +739,7 @@ def expect_token_value(tok)
739
739
# token_value works for when the scanner matched something
740
740
# which is usually fine and it's good for it to be fast at that.
741
741
def debug_token_value
742
- if token_name && Lexer ::Punctuation . const_defined? ( token_name )
743
- Lexer ::Punctuation . const_get ( token_name )
744
- elsif token_name == :ELLIPSIS
745
- "..."
746
- else
747
- @lexer . token_value
748
- end
742
+ @lexer . debug_token_value ( token_name )
749
743
end
750
744
end
751
745
end
Original file line number Diff line number Diff line change 54
54
assert_equal expected_msg , err . message
55
55
end
56
56
57
+ it "handles hyphens with errors" do
58
+ err = assert_raises ( GraphQL ::ParseError ) {
59
+ GraphQL . parse ( "{ field(argument:a-b) }" )
60
+ }
61
+ expected_msg = if USING_C_PARSER
62
+ "syntax error, unexpected invalid token (\" -\" ) at [1, 19]"
63
+ else
64
+ "Expected NAME, actual: INT (\" -\" ) at [1, 19]"
65
+ end
66
+
67
+ assert_equal expected_msg , err . message
68
+ end
69
+
57
70
describe "anonymous fragment extension" do
58
71
let ( :document ) { GraphQL . parse ( query_string ) }
59
72
let ( :query_string ) { %|
You can’t perform that action at this time.
0 commit comments