Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Remove span stuff from !generateSpans tests
Browse files Browse the repository at this point in the history
  • Loading branch information
moffatman committed Jul 4, 2024
1 parent 7992c72 commit 3ee0eaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
3 changes: 3 additions & 0 deletions lib/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3959,6 +3959,9 @@ class ParseError implements SourceSpanException {

@override
String toString({dynamic color}) {
if (span == null) {
return message;
}
final res = span!.message(message, color: color);
return span!.sourceUrl == null ? 'ParserError on $res' : 'On $res';
}
Expand Down
10 changes: 1 addition & 9 deletions test/parser_feature_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ On line 4, column 3 of ParseError: Unexpected DOCTYPE. Ignored.
expect(parser.errors.length, 1);
final error = parser.errors[0];
expect(error.errorCode, 'unexpected-doctype');
expect(error.span!.start.line, 3);
// Note: error position is at the end, not the beginning
expect(error.span!.start.column, 17);
});

test('text spans should have the correct length', () {
Expand Down Expand Up @@ -256,12 +253,7 @@ On line 4, column 3 of ParseError: Unexpected DOCTYPE. Ignored.
'Unexpected non-space characters. Expected DOCTYPE.');
expect(
parser.errors[0].toString(),
'ParserError on line 1, column 4: Unexpected non-space characters. '
'Expected DOCTYPE.\n'
' ╷\n'
'1 │ foo\n'
' │ ^\n'
' ╵');
'Unexpected non-space characters. Expected DOCTYPE.');
});

test('Element.text', () {
Expand Down

0 comments on commit 3ee0eaa

Please sign in to comment.