Skip to content

Commit

Permalink
Test all possible errors
Browse files Browse the repository at this point in the history
  • Loading branch information
scripthunter7 committed Oct 17, 2023
1 parent 5722aae commit 29c332b
Showing 1 changed file with 54 additions and 1 deletion.
55 changes: 54 additions & 1 deletion packages/css-tokenizer/test/css-tokenizer/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,60 @@ describe('onError callback', () => {
[ErrorMessage.UnterminatedComment, 0, 18],
],
},
// FIXME: Test all possible errors
{
actual: '"eof in string',
expected: [
[ErrorMessage.UnexpectedEofInString, 0, 14],
],
},
{
actual: '"eof in string\\',
expected: [
[ErrorMessage.UnexpectedEofInString, 0, 15],
],
},
{
actual: '"newline in string\n',
expected: [
[ErrorMessage.UnexpectedNewlineInString, 0, 19],
],
},
{
actual: 'url(eof-in-url',
expected: [
[ErrorMessage.UnexpectedEofInUrl, 0, 14],
],
},
{
actual: 'url( ',
expected: [
[ErrorMessage.UnexpectedEofInUrl, 0, 6],
],
},
{
actual: 'url(a a)',
expected: [
[ErrorMessage.UnexpectedCharInUrl, 0, 6],
],
},
{
actual: 'url(aa"',
expected: [
[ErrorMessage.UnexpectedCharInUrl, 0, 6],
],
},
{
actual: "url(aa'",
expected: [
[ErrorMessage.UnexpectedCharInUrl, 0, 6],
],
},
{
actual: 'url(\\\n',
expected: [
[ErrorMessage.UnexpectedCharInUrl, 0, 4],
],
},
])('should report error for \'$actual\'', ({ actual, expected }) => {
const errors: ErrorData[] = [];
tokenize(actual, () => {}, (...args) => errors.push(args));
Expand Down

0 comments on commit 29c332b

Please sign in to comment.