Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2229)

Unified Diff: pkg/front_end/test/scanner_fasta_test.dart

Issue 3002493002: generate synthetic and error tokens when missing digit (Closed)
Patch Set: rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/utf8_bytes_scanner.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/scanner_fasta_test.dart
diff --git a/pkg/front_end/test/scanner_fasta_test.dart b/pkg/front_end/test/scanner_fasta_test.dart
index 01b1aa594e1a881273cd619bbd3130ea1c22edae..567373fe8a9af0891254bb81c0d0f3d449daae14 100644
--- a/pkg/front_end/test/scanner_fasta_test.dart
+++ b/pkg/front_end/test/scanner_fasta_test.dart
@@ -225,6 +225,26 @@ main() {}
}
}
+ void test_double_error() {
+ String source = "3457e";
+ ErrorListener listener = new ErrorListener();
+ Token token = scanWithListener(source, listener);
+ expect(token, isNotNull);
+ expect(token.type, TokenType.DOUBLE);
+ expect(token.offset, 0);
+ expect(token.isSynthetic, isTrue);
+ // the invalid token is updated to be valid ...
+ expect(token.lexeme, source + "0");
+ // ... but the length does *not* include the additional character
+ // so as to be true to the original source.
+ expect(token.length, source.length);
+ expect(token.next.isEof, isTrue);
+ expect(listener.errors, hasLength(1));
+ TestError error = listener.errors[0];
+ expect(error.errorCode, ScannerErrorCode.MISSING_DIGIT);
+ expect(error.offset, source.length - 1);
+ }
+
@override
void test_mismatched_opener_in_interpolation() {
// When openers and closers are mismatched,
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/utf8_bytes_scanner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698