Skip to content

Commit 86a9145

Browse files
committed
lexer-tests: Use tildas as invalid characters
Question marks may become valid characters, needed to pick something different. Replicates graphql/graphql-js@cce8a85
1 parent 46cf844 commit 86a9145

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tests/language/test_lexer.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,47 +73,47 @@ def skips_whitespace_and_comments():
7373

7474
def errors_respect_whitespace():
7575
with raises(GraphQLSyntaxError) as exc_info:
76-
lex_one("\n\n ?\n")
76+
lex_one("\n\n ~\n")
7777

7878
assert str(exc_info.value) == dedent(
7979
"""
80-
Syntax Error: Unexpected character: '?'.
80+
Syntax Error: Unexpected character: '~'.
8181
82-
GraphQL request:3:5
82+
GraphQL request:3:2
8383
2 |
84-
3 | ?
84+
3 | ~
8585
| ^
8686
4 |
8787
"""
8888
)
8989

9090
def updates_line_numbers_in_error_for_file_context():
91-
s = "\n\n ?\n\n"
91+
s = "\n\n ~\n\n"
9292
source = Source(s, "foo.js", SourceLocation(11, 12))
9393
with raises(GraphQLSyntaxError) as exc_info:
9494
Lexer(source).advance()
9595
assert str(exc_info.value) == dedent(
9696
"""
97-
Syntax Error: Unexpected character: '?'.
97+
Syntax Error: Unexpected character: '~'.
9898
9999
foo.js:13:6
100100
12 |
101-
13 | ?
101+
13 | ~
102102
| ^
103103
14 |
104104
"""
105105
)
106106

107107
def updates_column_numbers_in_error_for_file_context():
108-
source = Source("?", "foo.js", SourceLocation(1, 5))
108+
source = Source("~", "foo.js", SourceLocation(1, 5))
109109
with raises(GraphQLSyntaxError) as exc_info:
110110
Lexer(source).advance()
111111
assert str(exc_info.value) == dedent(
112112
"""
113-
Syntax Error: Unexpected character: '?'.
113+
Syntax Error: Unexpected character: '~'.
114114
115115
foo.js:1:5
116-
1 | ?
116+
1 | ~
117117
| ^
118118
"""
119119
)
@@ -527,7 +527,7 @@ def lexes_punctuation():
527527

528528
def lex_reports_useful_unknown_character_error():
529529
assert_syntax_error("..", "Unexpected character: '.'.", (1, 1))
530-
assert_syntax_error("?", "Unexpected character: '?'.", (1, 1))
530+
assert_syntax_error("~", "Unexpected character: '~'.", (1, 1))
531531
assert_syntax_error("\x00", "Unexpected character: U+0000.", (1, 1))
532532
assert_syntax_error("\b", "Unexpected character: U+0008.", (1, 1))
533533
assert_syntax_error("\xAA", "Unexpected character: U+00AA.", (1, 1))

0 commit comments

Comments
 (0)