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

Unified Diff: pkg/analyzer/test/generated/scanner_test.dart

Issue 1043583002: Scanner/parser support for DEP 9 (null-aware operators). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
Index: pkg/analyzer/test/generated/scanner_test.dart
diff --git a/pkg/analyzer/test/generated/scanner_test.dart b/pkg/analyzer/test/generated/scanner_test.dart
index b65bd51e7b1f031a1ecc97cb3b7dcec511f17a4c..35318470137dcd338d7f9b8ede505ce61e4d6b9b 100644
--- a/pkg/analyzer/test/generated/scanner_test.dart
+++ b/pkg/analyzer/test/generated/scanner_test.dart
@@ -170,6 +170,12 @@ class KeywordStateTest {
@reflectiveTest
class ScannerTest {
+ /**
+ * If non-null, this value is used to override the default value of
+ * [Scanner.enableNullAwareOperators] before scanning.
+ */
+ bool _enableNullAwareOperators;
+
void fail_incomplete_string_interpolation() {
// https://code.google.com/p/dart/issues/detail?id=18073
_assertErrorAndTokens(ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 9,
@@ -720,6 +726,21 @@ class ScannerTest {
_assertToken(TokenType.QUESTION, "?");
}
+ void test_question_dot() {
+ _enableNullAwareOperators = true;
+ _assertToken(TokenType.QUESTION_PERIOD, "?.");
+ }
+
+ void test_question_question() {
+ _enableNullAwareOperators = true;
+ _assertToken(TokenType.QUESTION_QUESTION, "??");
+ }
+
+ void test_question_question_eq() {
+ _enableNullAwareOperators = true;
+ _assertToken(TokenType.QUESTION_QUESTION_EQ, "??=");
+ }
+
void test_scriptTag_withArgs() {
_assertToken(TokenType.SCRIPT_TAG, "#!/bin/dart -debug");
}
@@ -1208,6 +1229,9 @@ class ScannerTest {
Token _scanWithListener(String source, GatheringErrorListener listener) {
Scanner scanner =
new Scanner(null, new CharSequenceReader(source), listener);
+ if (_enableNullAwareOperators != null) {
+ scanner.enableNullAwareOperators = _enableNullAwareOperators;
+ }
Token result = scanner.tokenize();
listener.setLineInfo(new TestSource(), scanner.lineStarts);
return result;
« pkg/analyzer/test/generated/parser_test.dart ('K') | « pkg/analyzer/test/generated/parser_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698