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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1570183002: add parser parseAsync flag (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.src.task.dart_test; 5 library analyzer.test.src.task.dart_test;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/dart/element/element.dart'; 10 import 'package:analyzer/src/dart/element/element.dart';
(...skipping 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after
2986 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); 2986 expect(outputs[EXPORTED_LIBRARIES], hasLength(0));
2987 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); 2987 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1);
2988 expect(outputs[INCLUDED_PARTS], hasLength(0)); 2988 expect(outputs[INCLUDED_PARTS], hasLength(0));
2989 expect(outputs[LIBRARY_SPECIFIC_UNITS], hasLength(1)); 2989 expect(outputs[LIBRARY_SPECIFIC_UNITS], hasLength(1));
2990 expect(outputs[PARSE_ERRORS], hasLength(0)); 2990 expect(outputs[PARSE_ERRORS], hasLength(0));
2991 expect(outputs[PARSED_UNIT], isNotNull); 2991 expect(outputs[PARSED_UNIT], isNotNull);
2992 expect(outputs[SOURCE_KIND], SourceKind.PART); 2992 expect(outputs[SOURCE_KIND], SourceKind.PART);
2993 expect(outputs[UNITS], hasLength(1)); 2993 expect(outputs[UNITS], hasLength(1));
2994 } 2994 }
2995 2995
2996 test_perform_enableAsync_false() {
2997 AnalysisOptionsImpl options = new AnalysisOptionsImpl();
2998 options.enableAsync = false;
2999 prepareAnalysisContext(options);
3000 _performParseTask(r'''
3001 import 'dart:async';
3002 class B {void foo() async {}}''');
3003 expect(outputs, hasLength(9));
3004 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(1));
3005 expect(outputs[EXPORTED_LIBRARIES], hasLength(0));
3006 _assertHasCore(outputs[IMPORTED_LIBRARIES], 2);
3007 expect(outputs[INCLUDED_PARTS], hasLength(0));
3008 expect(outputs[LIBRARY_SPECIFIC_UNITS], hasLength(1));
3009 expect(outputs[PARSE_ERRORS], hasLength(1));
3010 expect(outputs[PARSED_UNIT], isNotNull);
3011 expect(outputs[SOURCE_KIND], SourceKind.LIBRARY);
3012 expect(outputs[UNITS], hasLength(1));
3013 }
3014
3015 test_perform_enableAsync_true() {
3016 _performParseTask(r'''
3017 import 'dart:async';
3018 class B {void foo() async {}}''');
3019 expect(outputs, hasLength(9));
3020 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(1));
3021 expect(outputs[EXPORTED_LIBRARIES], hasLength(0));
3022 _assertHasCore(outputs[IMPORTED_LIBRARIES], 2);
3023 expect(outputs[INCLUDED_PARTS], hasLength(0));
3024 expect(outputs[LIBRARY_SPECIFIC_UNITS], hasLength(1));
3025 expect(outputs[PARSE_ERRORS], hasLength(0));
3026 expect(outputs[PARSED_UNIT], isNotNull);
3027 expect(outputs[SOURCE_KIND], SourceKind.LIBRARY);
3028 expect(outputs[UNITS], hasLength(1));
3029 }
3030
2996 test_perform_computeSourceKind_noDirectives_hasContainingLibrary() { 3031 test_perform_computeSourceKind_noDirectives_hasContainingLibrary() {
2997 // Parse "lib.dart" to let the context know that "test.dart" is included. 3032 // Parse "lib.dart" to let the context know that "test.dart" is included.
2998 computeResult( 3033 computeResult(
2999 newSource( 3034 newSource(
3000 '/lib.dart', 3035 '/lib.dart',
3001 r''' 3036 r'''
3002 library lib; 3037 library lib;
3003 part 'test.dart'; 3038 part 'test.dart';
3004 '''), 3039 '''),
3005 PARSED_UNIT); 3040 PARSED_UNIT);
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
4811 /** 4846 /**
4812 * Fill [errorListener] with [result] errors in the current [task]. 4847 * Fill [errorListener] with [result] errors in the current [task].
4813 */ 4848 */
4814 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 4849 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
4815 List<AnalysisError> errors = task.outputs[result]; 4850 List<AnalysisError> errors = task.outputs[result];
4816 expect(errors, isNotNull, reason: result.name); 4851 expect(errors, isNotNull, reason: result.name);
4817 errorListener = new GatheringErrorListener(); 4852 errorListener = new GatheringErrorListener();
4818 errorListener.addAll(errors); 4853 errorListener.addAll(errors);
4819 } 4854 }
4820 } 4855 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | pkg/analyzer/test/src/task/options_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698