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

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

Issue 2948473002: integrating fasta parser (Closed)
Patch Set: Created 3 years, 6 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/analyzer/lib/src/generated/parser_fasta.dart ('k') | pkg/front_end/lib/src/scanner/scanner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/parser_fasta_test.dart
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index e379dee465c41b049f4ddf349a1d298695a183b7..ca1c58762bc3a5b61345001af10014dab7b3156c 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -6,10 +6,12 @@ import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart' as analyzer;
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/error/error.dart';
+import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/fasta/ast_builder.dart';
import 'package:analyzer/src/fasta/element_store.dart';
import 'package:analyzer/src/generated/parser.dart' as analyzer;
import 'package:analyzer/src/generated/utilities_dart.dart';
+import 'package:analyzer/src/string_source.dart';
import 'package:front_end/src/fasta/kernel/kernel_builder.dart';
import 'package:front_end/src/fasta/kernel/kernel_library_builder.dart';
import 'package:front_end/src/fasta/parser/identifier_context.dart'
@@ -21,6 +23,7 @@ import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'parser_test.dart';
+import 'test_support.dart';
main() {
defineReflectiveSuite(() {
@@ -387,10 +390,23 @@ class FastaParserTestCase extends Object
}
@override
- CompilationUnit parseCompilationUnit(String source,
- [List<ErrorCode> errorCodes = const <ErrorCode>[]]) {
- return _runParser(source, (parser) => parser.parseUnit, errorCodes)
- as CompilationUnit;
+ CompilationUnit parseCompilationUnit(String content,
+ [List<ErrorCode> expectedErrorCodes = const <ErrorCode>[]]) {
+ // Scan tokens
+ var source = new StringSource(content, 'parser_test_StringSource.dart');
+ GatheringErrorListener listener = new GatheringErrorListener();
+ var scanner = new Scanner.fasta(source, listener);
+ scanner.scanGenericMethodComments = enableGenericMethodComments;
+ _fastaTokens = scanner.tokenize();
+
+ // Run parser
+ analyzer.Parser parser =
+ new analyzer.Parser(source, listener, useFasta: true);
+ CompilationUnit unit = parser.parseCompilationUnit(_fastaTokens);
+
+ // Assert and return result
+ listener.assertErrorsWithCodes(expectedErrorCodes);
+ return unit;
}
@override
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser_fasta.dart ('k') | pkg/front_end/lib/src/scanner/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698