Index: pkg/analyzer/test/generated/parser_test.dart |
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart |
index 98e80de36f5522bf50147d2a8d31bbfa39935ccf..dab21e966fe575207aa8f676ca38bf114e48ed7c 100644 |
--- a/pkg/analyzer/test/generated/parser_test.dart |
+++ b/pkg/analyzer/test/generated/parser_test.dart |
@@ -3221,6 +3221,17 @@ class B = Object with A {}''', |
expect(expression.thenExpression.isSynthetic, isTrue); |
} |
+ void test_declarationBeforeDirective() { |
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit( |
+ "class foo { } import 'bar.dart';", |
+ [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); |
+ expect(unit.directives, hasLength(1)); |
+ expect(unit.declarations, hasLength(1)); |
+ ClassDeclaration classDecl = unit.childEntities.first; |
+ expect(classDecl, isNotNull); |
+ expect(classDecl.name.name, 'foo'); |
+ } |
+ |
void test_equalityExpression_missing_LHS() { |
BinaryExpression expression = |
parseExpression("== y", [ParserErrorCode.MISSING_IDENTIFIER]); |
@@ -3338,17 +3349,6 @@ class B = Object with A {}''', |
parseExpression("m(f() => 0);", [ParserErrorCode.EXPECTED_TOKEN]); |
} |
- void test_declarationBeforeDirective() { |
- CompilationUnit unit = ParserTestCase.parseCompilationUnit( |
- "class foo { } import 'bar.dart';", |
- [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); |
- expect(unit.directives, hasLength(1)); |
- expect(unit.declarations, hasLength(1)); |
- ClassDeclaration classDecl = unit.childEntities.first; |
- expect(classDecl, isNotNull); |
- expect(classDecl.name.name, 'foo'); |
- } |
- |
void test_importDirectivePartial_as() { |
CompilationUnit unit = ParserTestCase.parseCompilationUnit( |
"import 'b.dart' d as b;", [ParserErrorCode.UNEXPECTED_TOKEN]); |
@@ -5045,6 +5045,36 @@ class SimpleParserTest extends ParserTestCase { |
expect(statement.assertKeyword, isNotNull); |
expect(statement.leftParenthesis, isNotNull); |
expect(statement.condition, isNotNull); |
+ expect(statement.comma, isNull); |
+ expect(statement.message, isNull); |
+ expect(statement.rightParenthesis, isNotNull); |
+ expect(statement.semicolon, isNotNull); |
+ } |
+ |
+ void test_parseAssertStatement_messageLowPrecedence() { |
+ // Using a throw expression as an assert message would be silly in |
+ // practice, but it's the lowest precedence expression type, so verifying |
+ // that it works should give us high confidence that other expression types |
+ // will work as well. |
+ AssertStatement statement = |
+ parse4('parseAssertStatement', 'assert (x, throw "foo");'); |
+ expect(statement.assertKeyword, isNotNull); |
+ expect(statement.leftParenthesis, isNotNull); |
+ expect(statement.condition, isNotNull); |
+ expect(statement.comma, isNotNull); |
+ expect(statement.message, isNotNull); |
+ expect(statement.rightParenthesis, isNotNull); |
+ expect(statement.semicolon, isNotNull); |
+ } |
+ |
+ void test_parseAssertStatement_messageString() { |
+ AssertStatement statement = |
+ parse4('parseAssertStatement', 'assert (x, "foo");'); |
+ expect(statement.assertKeyword, isNotNull); |
+ expect(statement.leftParenthesis, isNotNull); |
+ expect(statement.condition, isNotNull); |
+ expect(statement.comma, isNotNull); |
+ expect(statement.message, isNotNull); |
expect(statement.rightParenthesis, isNotNull); |
expect(statement.semicolon, isNotNull); |
} |