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

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

Issue 1622313003: Add minimal yaml support to the engine (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address Comments 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
« no previous file with comments | « pkg/analyzer/lib/task/yaml.dart ('k') | pkg/analyzer/test/src/task/test_all.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/visitor.dart'; 8 import 'package:analyzer/dart/ast/visitor.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 test_perform_doesNotExist() { 3045 test_perform_doesNotExist() {
3046 _performParseTask(null); 3046 _performParseTask(null);
3047 expect(outputs, hasLength(9)); 3047 expect(outputs, hasLength(9));
3048 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(0)); 3048 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(0));
3049 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); 3049 expect(outputs[EXPORTED_LIBRARIES], hasLength(0));
3050 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); 3050 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1);
3051 expect(outputs[INCLUDED_PARTS], hasLength(0)); 3051 expect(outputs[INCLUDED_PARTS], hasLength(0));
3052 expect(outputs[LIBRARY_SPECIFIC_UNITS], hasLength(1)); 3052 expect(outputs[LIBRARY_SPECIFIC_UNITS], hasLength(1));
3053 expect(outputs[PARSE_ERRORS], hasLength(0)); 3053 expect(outputs[PARSE_ERRORS], hasLength(0));
3054 expect(outputs[PARSED_UNIT], isNotNull); 3054 expect(outputs[PARSED_UNIT], isNotNull);
3055 expect(outputs[SOURCE_KIND], SourceKind.UNKNOWN); 3055 expect(outputs[SOURCE_KIND], SourceKind.LIBRARY);
3056 expect(outputs[UNITS], hasLength(1)); 3056 expect(outputs[UNITS], hasLength(1));
3057 } 3057 }
3058 3058
3059 test_perform_enableAsync_false() { 3059 test_perform_enableAsync_false() {
3060 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); 3060 AnalysisOptionsImpl options = new AnalysisOptionsImpl();
3061 options.enableAsync = false; 3061 options.enableAsync = false;
3062 prepareAnalysisContext(options); 3062 prepareAnalysisContext(options);
3063 _performParseTask(r''' 3063 _performParseTask(r'''
3064 import 'dart:async'; 3064 import 'dart:async';
3065 class B {void foo() async {}}'''); 3065 class B {void foo() async {}}''');
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); 3155 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1);
3156 expect(outputs[INCLUDED_PARTS], hasLength(0)); 3156 expect(outputs[INCLUDED_PARTS], hasLength(0));
3157 expect(outputs[LIBRARY_SPECIFIC_UNITS], hasLength(1)); 3157 expect(outputs[LIBRARY_SPECIFIC_UNITS], hasLength(1));
3158 expect(outputs[PARSE_ERRORS], hasLength(0)); 3158 expect(outputs[PARSE_ERRORS], hasLength(0));
3159 expect(outputs[PARSED_UNIT], isNotNull); 3159 expect(outputs[PARSED_UNIT], isNotNull);
3160 expect(outputs[SOURCE_KIND], SourceKind.PART); 3160 expect(outputs[SOURCE_KIND], SourceKind.PART);
3161 expect(outputs[UNITS], hasLength(1)); 3161 expect(outputs[UNITS], hasLength(1));
3162 } 3162 }
3163 3163
3164 void _performParseTask(String content) { 3164 void _performParseTask(String content) {
3165 source = newSource('/test.dart', content); 3165 if (content == null) {
3166 source = resourceProvider.getFile('/test.dart').createSource();
3167 } else {
3168 source = newSource('/test.dart', content);
3169 }
3166 computeResult(source, PARSED_UNIT, matcher: isParseDartTask); 3170 computeResult(source, PARSED_UNIT, matcher: isParseDartTask);
3167 } 3171 }
3168 3172
3169 static void _assertHasCore(List<Source> sources, int lenght) { 3173 static void _assertHasCore(List<Source> sources, int lenght) {
3170 expect(sources, hasLength(lenght)); 3174 expect(sources, hasLength(lenght));
3171 expect(sources, contains(predicate((Source s) { 3175 expect(sources, contains(predicate((Source s) {
3172 return s.fullName.endsWith('core.dart'); 3176 return s.fullName.endsWith('core.dart');
3173 }))); 3177 })));
3174 } 3178 }
3175 } 3179 }
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
4875 /** 4879 /**
4876 * Fill [errorListener] with [result] errors in the current [task]. 4880 * Fill [errorListener] with [result] errors in the current [task].
4877 */ 4881 */
4878 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 4882 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
4879 List<AnalysisError> errors = task.outputs[result]; 4883 List<AnalysisError> errors = task.outputs[result];
4880 expect(errors, isNotNull, reason: result.name); 4884 expect(errors, isNotNull, reason: result.name);
4881 errorListener = new GatheringErrorListener(); 4885 errorListener = new GatheringErrorListener();
4882 errorListener.addAll(errors); 4886 errorListener.addAll(errors);
4883 } 4887 }
4884 } 4888 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/task/yaml.dart ('k') | pkg/analyzer/test/src/task/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698