Skip to content

Commit cce8a85

Browse files
authored
lexer-tests: Use tildas as invalid characters (#3377)
1 parent 0d1297a commit cce8a85

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/language/__tests__/lexer-test.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -168,36 +168,36 @@ describe('Lexer', () => {
168168
it('errors respect whitespace', () => {
169169
let caughtError;
170170
try {
171-
lexOne(['', '', ' ?', ''].join('\n'));
171+
lexOne(['', '', ' ~', ''].join('\n'));
172172
} catch (error) {
173173
caughtError = error;
174174
}
175175
expect(String(caughtError)).to.equal(dedent`
176-
Syntax Error: Unexpected character: "?".
176+
Syntax Error: Unexpected character: "~".
177177
178-
GraphQL request:3:5
178+
GraphQL request:3:2
179179
2 |
180-
3 | ?
181-
| ^
180+
3 | ~
181+
| ^
182182
4 |
183183
`);
184184
});
185185

186186
it('updates line numbers in error for file context', () => {
187187
let caughtError;
188188
try {
189-
const str = ['', '', ' ?', ''].join('\n');
189+
const str = ['', '', ' ~', ''].join('\n');
190190
const source = new Source(str, 'foo.js', { line: 11, column: 12 });
191191
new Lexer(source).advance();
192192
} catch (error) {
193193
caughtError = error;
194194
}
195195
expect(String(caughtError)).to.equal(dedent`
196-
Syntax Error: Unexpected character: "?".
196+
Syntax Error: Unexpected character: "~".
197197
198198
foo.js:13:6
199199
12 |
200-
13 | ?
200+
13 | ~
201201
| ^
202202
14 |
203203
`);
@@ -206,16 +206,16 @@ describe('Lexer', () => {
206206
it('updates column numbers in error for file context', () => {
207207
let caughtError;
208208
try {
209-
const source = new Source('?', 'foo.js', { line: 1, column: 5 });
209+
const source = new Source('~', 'foo.js', { line: 1, column: 5 });
210210
new Lexer(source).advance();
211211
} catch (error) {
212212
caughtError = error;
213213
}
214214
expect(String(caughtError)).to.equal(dedent`
215-
Syntax Error: Unexpected character: "?".
215+
Syntax Error: Unexpected character: "~".
216216
217217
foo.js:1:5
218-
1 | ?
218+
1 | ~
219219
| ^
220220
`);
221221
});
@@ -1027,8 +1027,8 @@ describe('Lexer', () => {
10271027
locations: [{ line: 1, column: 1 }],
10281028
});
10291029

1030-
expectSyntaxError('?').to.deep.equal({
1031-
message: 'Syntax Error: Unexpected character: "?".',
1030+
expectSyntaxError('~').to.deep.equal({
1031+
message: 'Syntax Error: Unexpected character: "~".',
10321032
locations: [{ line: 1, column: 1 }],
10331033
});
10341034

0 commit comments

Comments
 (0)