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

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

Issue 2769253002: change "deferred" keyword isPseudo --> isBuiltIn (Closed)
Patch Set: rebase Created 3 years, 9 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/test/scanner_roundtrip_test.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/token_test.dart
diff --git a/pkg/front_end/test/token_test.dart b/pkg/front_end/test/token_test.dart
index b6c5497e6c1cd4bbc3249f7187e169917778676f..1e3a1227ff71475ffc522cc93d68bba0425f03b8 100644
--- a/pkg/front_end/test/token_test.dart
+++ b/pkg/front_end/test/token_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:front_end/src/fasta/scanner/string_scanner.dart';
+import 'package:front_end/src/fasta/scanner/keyword.dart' as fasta;
import 'package:front_end/src/fasta/scanner/token.dart' as fasta;
import 'package:front_end/src/scanner/token.dart';
import 'package:front_end/src/scanner/reader.dart' as analyzer;
@@ -154,6 +155,60 @@ class Foo {
expect(token.matchesAny([TokenType.AMPERSAND]), false);
}
+ /// Return all fasta and all analyzer keywords
+ List<Keyword> get _allKeywords =>
+ new List.from(Keyword.values)..addAll(fasta.Keyword.values);
+
+ void test_built_in_keywords() {
+ var builtInKeywords = new Set<Keyword>.from([
+ Keyword.ABSTRACT,
+ Keyword.AS,
+ Keyword.COVARIANT,
+ Keyword.DEFERRED,
+ Keyword.DYNAMIC,
+ Keyword.EXPORT,
+ Keyword.EXTERNAL,
+ Keyword.FACTORY,
+ Keyword.GET,
+ Keyword.IMPLEMENTS,
+ Keyword.IMPORT,
+ Keyword.LIBRARY,
+ Keyword.OPERATOR,
+ Keyword.PART,
+ Keyword.SET,
+ Keyword.STATIC,
+ Keyword.TYPEDEF,
+ ]);
+ for (Keyword keyword in _allKeywords) {
+ var isBuiltIn = builtInKeywords.contains(keyword);
+ expect(keyword.isPseudoKeyword, isBuiltIn, reason: keyword.name);
+ expect((keyword as fasta.Keyword).isBuiltIn, isBuiltIn,
+ reason: keyword.name);
+ }
+ }
+
+ void test_pseudo_keywords() {
+ var pseudoKeywords = new Set<Keyword>.from([
+ fasta.Keyword.ASYNC,
+ fasta.Keyword.AWAIT,
+ fasta.Keyword.FUNCTION,
+ fasta.Keyword.HIDE,
+ fasta.Keyword.NATIVE,
+ fasta.Keyword.OF,
+ fasta.Keyword.ON,
+ fasta.Keyword.PATCH,
+ fasta.Keyword.SHOW,
+ fasta.Keyword.SOURCE,
+ fasta.Keyword.SYNC,
+ fasta.Keyword.YIELD,
+ ]);
+ for (Keyword keyword in _allKeywords) {
+ var isPseudo = pseudoKeywords.contains(keyword);
+ expect((keyword as fasta.Keyword).isPseudo, isPseudo,
+ reason: keyword.name);
+ }
+ }
+
void test_value() {
var scanner = new StringScanner('true & "home"', includeComments: true);
var token = scanner.tokenize();
@@ -166,7 +221,6 @@ class Foo {
expect(token.value(), '&');
// String tokens
token = token.next;
- print('String token :: ${token.runtimeType}');
expect(token.lexeme, '"home"');
expect(token.value(), '"home"');
}
« no previous file with comments | « pkg/front_end/test/scanner_roundtrip_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698