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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 2940783002: update analyzer tests for fasta scanner (Closed)
Patch Set: rebase 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index 9ea09a084c9d3b9dd63e0f9b0857b9aece2894c4..daa890470d394558da5d3db1ae9a1558e4ee32da 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -27,6 +27,7 @@ import 'package:analyzer/src/task/strong/ast_properties.dart' as strong_ast;
import 'package:analyzer/task/dart.dart';
import 'package:analyzer/task/general.dart';
import 'package:analyzer/task/model.dart';
+import 'package:front_end/src/scanner/scanner.dart' as fe;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -3261,7 +3262,12 @@ class A {''');
_assertHasCore(outputs[IMPORTED_LIBRARIES], 2);
expect(outputs[INCLUDED_PARTS], hasLength(1));
expect(outputs[LIBRARY_SPECIFIC_UNITS], hasLength(2));
- expect(outputs[PARSE_ERRORS], hasLength(1));
+ if (fe.Scanner.useFasta) {
+ // Missing closing brace error is reported by the Fasta scanner.
+ expect(outputs[PARSE_ERRORS], hasLength(0));
+ } else {
+ expect(outputs[PARSE_ERRORS], hasLength(1));
+ }
expect(outputs[PARSED_UNIT], isNotNull);
expect(outputs[REFERENCED_SOURCES], hasLength(5));
expect(outputs[SOURCE_KIND], SourceKind.LIBRARY);
@@ -4387,6 +4393,23 @@ bar(); //ignore: error_code, error_code_2
expect(ignoreInfo.hasIgnores, isFalse);
}
+ test_perform_library() {
+ _performScanTask(r'''
+library lib;
+import 'lib2.dart';
+export 'lib3.dart';
+part 'part.dart';
+class A {''');
+ expect(outputs, hasLength(4));
+ expect(outputs[LINE_INFO], isNotNull);
+ // Missing closing brace error is reported by the Fasta scanner.
+ expect(outputs[SCAN_ERRORS], hasLength(fe.Scanner.useFasta ? 1 : 0));
+ expect(outputs[TOKEN_STREAM], isNotNull);
+ IgnoreInfo ignoreInfo = outputs[IGNORE_INFO];
+ expect(ignoreInfo, isNotNull);
+ expect(ignoreInfo.hasIgnores, isFalse);
+ }
+
test_perform_noErrors() {
_performScanTask('class A {}');
expect(outputs, hasLength(4));
@@ -4418,7 +4441,12 @@ bar(); //ignore: error_code, error_code_2
computeResult(script, TOKEN_STREAM, matcher: isScanDartTask);
expect(outputs[LINE_INFO], isNotNull);
- expect(outputs[SCAN_ERRORS], isEmpty);
+ if (fe.Scanner.useFasta) {
+ // Missing closing brace error is reported by Fasta scanner.
+ expect(outputs[SCAN_ERRORS], hasLength(1));
+ } else {
+ expect(outputs[SCAN_ERRORS], isEmpty);
+ }
Token tokenStream = outputs[TOKEN_STREAM];
expect(tokenStream, isNotNull);
expect(tokenStream.lexeme, 'void');
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698