cleanup tests
* fix TokenType.IDENTIFIER name
* fix utf8 scanner tests to actually test the utf8 scanner
Change-Id: Ib87d322cf30402f9f95bae0e66a07e13192ed368
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102404
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
diff --git a/pkg/front_end/lib/src/scanner/token.dart b/pkg/front_end/lib/src/scanner/token.dart
index 0ffd35b..9f1ba8a 100644
--- a/pkg/front_end/lib/src/scanner/token.dart
+++ b/pkg/front_end/lib/src/scanner/token.dart
@@ -1153,7 +1153,7 @@
stringValue: null);
static const TokenType IDENTIFIER = const TokenType(
- 'identifier', 'STRING_INT', NO_PRECEDENCE, IDENTIFIER_TOKEN,
+ 'identifier', 'IDENTIFIER', NO_PRECEDENCE, IDENTIFIER_TOKEN,
stringValue: null);
static const TokenType INT = const TokenType(
diff --git a/pkg/front_end/test/scanner_fasta_test.dart b/pkg/front_end/test/scanner_fasta_test.dart
index 6af6e46..abe0879 100644
--- a/pkg/front_end/test/scanner_fasta_test.dart
+++ b/pkg/front_end/test/scanner_fasta_test.dart
@@ -51,6 +51,27 @@
@reflectiveTest
class ScannerTest_Fasta_UTF8 extends ScannerTest_Fasta {
+ @override
+ Token scanWithListener(String source, ErrorListener listener) {
+ var bytes = utf8.encode(source).toList()..add(0);
+ var result = scan(bytes, includeComments: true);
+ var token = result.tokens;
+
+ // Translate error tokens
+ if (result.hasErrors) {
+ while (token is ErrorToken) {
+ translateErrorToken(token,
+ (ScannerErrorCode errorCode, int offset, List<Object> arguments) {
+ listener.errors.add(new TestError(offset, errorCode, arguments));
+ });
+ token = token.next;
+ }
+ }
+
+ new Token.eof(-1)..setNext(token);
+ return token;
+ }
+
test_invalid_utf8() {
printBytes(List<int> bytes) {
var hex = bytes.map((b) => '0x${b.toRadixString(16).toUpperCase()}');