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

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

Issue 2672403004: Begin hooking up Fasta to analyzer parser tests. (Closed)
Patch Set: Created 3 years, 10 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/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 77f83b28a630937efab904c2c4b99627d6a92704..1f2c5fe8b4ac6b16e7e5da3e82c34864f8e4044b 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -34,6 +34,22 @@ main() {
}
/**
+ * Abstract base class for parser tests, which does not make assumptions about
+ * which parser is used.
+ */
+abstract class AbstractParserTestCase {
+ void set enableGenericMethodComments(bool value);
+
+ void set enableNnbd(bool value);
+
+ CompilationUnit parseCompilationUnitWithOptions(String source,
+ [List<ErrorCode> errorCodes = const <ErrorCode>[]]);
+
+ Expression parseExpression(String source,
+ [List<ErrorCode> errorCodes = const <ErrorCode>[]]);
+}
+
+/**
* Instances of the class `AstValidator` are used to validate the correct construction of an
* AST structure.
*/
@@ -109,14 +125,19 @@ class AstValidator extends UnifyingAstVisitor<Object> {
}
/**
+ * Tests of the analyzer parser based on [ComplexParserTestMixin].
+ */
+@reflectiveTest
+class ComplexParserTest extends ParserTestCase with ComplexParserTestMixin {}
+
+/**
* The class `ComplexParserTest` defines parser tests that test the parsing of more complex
* code fragments or the interactions between multiple parsing methods. For example, tests to ensure
* that the precedence of operations is being handled correctly should be defined in this class.
*
* Simpler tests should be defined in the class [SimpleParserTest].
*/
-@reflectiveTest
-class ComplexParserTest extends ParserTestCase {
+abstract class ComplexParserTestMixin implements AbstractParserTestCase {
void test_additiveExpression_normal() {
BinaryExpression expression = parseExpression("x + y - z");
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
@@ -2953,7 +2974,11 @@ class NonErrorParserTest extends ParserTestCase {
}
}
-class ParserTestCase extends EngineTestCase {
+/**
+ * Implementation of [AbstractParserTestCase] specialized for testing the
+ * analyzer parser.
+ */
+class ParserTestCase extends EngineTestCase implements AbstractParserTestCase {
/**
* A flag indicating whether parser is to parse function bodies.
*/
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test_fasta.dart » ('j') | pkg/analyzer/test/generated/parser_test_fasta.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698