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

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

Issue 2799133003: enhance analyzer to parse uppercase and built-in/pseudo keywords (Closed)
Patch Set: Created 3 years, 8 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
Index: pkg/front_end/test/scanner_test.dart
diff --git a/pkg/front_end/test/scanner_test.dart b/pkg/front_end/test/scanner_test.dart
index bfcad1a556f536d34d3fea7860875e5b627aeb23..6737d293bbb55d9fa728095d699b0e317980afc9 100644
--- a/pkg/front_end/test/scanner_test.dart
+++ b/pkg/front_end/test/scanner_test.dart
@@ -180,7 +180,7 @@ abstract class ScannerTestBase {
void test_async_star() {
Token token = _scan("async*");
- expect(token.type, TokenType.IDENTIFIER);
+ expect(token.type, TokenType.KEYWORD);
expect(token.lexeme, 'async');
expect(token.next.type, TokenType.STAR);
expect(token.next.next.type, TokenType.EOF);
@@ -471,11 +471,11 @@ abstract class ScannerTestBase {
}
void test_keyword_async() {
- _assertIdentifierToken("async");
+ _assertKeywordToken("async");
}
void test_keyword_await() {
- _assertIdentifierToken("await");
+ _assertKeywordToken("await");
}
void test_keyword_break() {
@@ -559,7 +559,7 @@ abstract class ScannerTestBase {
}
void test_keyword_hide() {
- _assertIdentifierToken("hide");
+ _assertKeywordToken("hide");
}
void test_keyword_if() {
@@ -587,7 +587,7 @@ abstract class ScannerTestBase {
}
void test_keyword_native() {
- _assertIdentifierToken("native");
+ _assertKeywordToken("native");
}
void test_keyword_new() {
@@ -599,11 +599,11 @@ abstract class ScannerTestBase {
}
void test_keyword_of() {
- _assertIdentifierToken("of");
+ _assertKeywordToken("of");
}
void test_keyword_on() {
- _assertIdentifierToken("on");
+ _assertKeywordToken("on");
}
void test_keyword_operator() {
@@ -615,7 +615,7 @@ abstract class ScannerTestBase {
}
void test_keyword_patch() {
- _assertIdentifierToken("patch");
+ _assertKeywordToken("patch");
}
void test_keyword_rethrow() {
@@ -631,11 +631,11 @@ abstract class ScannerTestBase {
}
void test_keyword_show() {
- _assertIdentifierToken("show");
+ _assertKeywordToken("show");
}
void test_keyword_source() {
- _assertIdentifierToken("source");
+ _assertKeywordToken("source");
}
void test_keyword_static() {
@@ -651,7 +651,7 @@ abstract class ScannerTestBase {
}
void test_keyword_sync() {
- _assertIdentifierToken("sync");
+ _assertKeywordToken("sync");
}
void test_keyword_this() {
@@ -691,7 +691,7 @@ abstract class ScannerTestBase {
}
void test_keyword_yield() {
- _assertIdentifierToken("yield");
+ _assertKeywordToken("yield");
}
void test_lt() {
@@ -1168,7 +1168,7 @@ abstract class ScannerTestBase {
void test_sync_star() {
Token token = _scan("sync*");
- expect(token.type, TokenType.IDENTIFIER);
+ expect(token.type, TokenType.KEYWORD);
expect(token.lexeme, 'sync');
expect(token.next.type, TokenType.STAR);
expect(token.next.next.type, TokenType.EOF);
@@ -1264,26 +1264,6 @@ abstract class ScannerTestBase {
}
/**
- * Assert that when scanned the given [source] contains a single identifier
- * token with the same lexeme as the original source.
- */
- void _assertIdentifierToken(String source) {
- void check(String s, int expectedOffset) {
- Token token = _scan(s);
- expect(token, isNotNull);
- expect(token.type, TokenType.IDENTIFIER);
- expect(token.offset, expectedOffset);
- expect(token.length, source.length);
- expect(token.lexeme, source);
- expect(token.value(), source);
- expect(token.next.type, TokenType.EOF);
- }
-
- check(source, 0);
- check(' $source ', 1);
- }
-
- /**
* Assert that when scanned the given [source] contains a single keyword token
* with the same lexeme as the original source.
*/

Powered by Google App Engine
This is Rietveld 408576698