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

Fix typo in the error message for max tokens #3748

Merged
merged 1 commit into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/language/__tests__/parser-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ describe('Parser', () => {
`);
});

it('limit maximum number of tokens', () => {
it('limits by a maximum number of tokens', () => {
expect(() => parse('{ foo }', { maxTokens: 3 })).to.not.throw();
expect(() => parse('{ foo }', { maxTokens: 2 })).to.throw(
'Syntax Error: Document contains more that 2 tokens. Parsing aborted.',
'Syntax Error: Document contains more than 2 tokens. Parsing aborted.',
);

expect(() => parse('{ foo(bar: "baz") }', { maxTokens: 8 })).to.not.throw();

expect(() => parse('{ foo(bar: "baz") }', { maxTokens: 7 })).to.throw(
'Syntax Error: Document contains more that 7 tokens. Parsing aborted.',
'Syntax Error: Document contains more than 7 tokens. Parsing aborted.',
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/language/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ export class Parser {
throw syntaxError(
this._lexer.source,
token.start,
`Document contains more that ${maxTokens} tokens. Parsing aborted.`,
`Document contains more than ${maxTokens} tokens. Parsing aborted.`,
);
}
}
Expand Down