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

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

Issue 1632113002: make checker_test, inferred_type_test easier to debug (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 // TODO(jmesserly): this file needs to be refactored, it's a port from 5 // TODO(jmesserly): this file needs to be refactored, it's a port from
6 // package:dev_compiler's tests 6 // package:dev_compiler's tests
7 library analyzer.test.src.task.strong.strong_test_helper; 7 library analyzer.test.src.task.strong.strong_test_helper;
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 /// * a file named `/main.dart` exists in [testFiles]. 196 /// * a file named `/main.dart` exists in [testFiles].
197 /// * all expected failures are listed in the source code using comments 197 /// * all expected failures are listed in the source code using comments
198 /// immediately in front of the AST node that should contain the error. 198 /// immediately in front of the AST node that should contain the error.
199 /// * errors are formatted as a token `level:Type`, where `level` is the 199 /// * errors are formatted as a token `level:Type`, where `level` is the
200 /// logging level were the error would be reported at, and `Type` is the 200 /// logging level were the error would be reported at, and `Type` is the
201 /// concrete subclass of [StaticInfo] that denotes the error. 201 /// concrete subclass of [StaticInfo] that denotes the error.
202 /// 202 ///
203 /// For example, to check that an assignment produces a warning about a boxing 203 /// For example, to check that an assignment produces a warning about a boxing
204 /// conversion, you can describe the test as follows: 204 /// conversion, you can describe the test as follows:
205 /// 205 ///
206 /// testChecker({ 206 /// testChecker('test feature', () => {
207 /// '/main.dart': ''' 207 /// '/main.dart': '''
208 /// testMethod() { 208 /// testMethod() {
209 /// dynamic x = /*warning:Box*/3; 209 /// dynamic x = /*warning:Box*/3;
210 /// } 210 /// }
211 /// ''' 211 /// '''
212 /// }); 212 /// });
213 /// 213 ///
214 void testChecker(String name, Map<String, String> testFiles) { 214 void testChecker(String name, Map<String, String> getTestFiles()) {
215 test(name, () { 215 test(name, () {
216 AnalysisEngine.instance.processRequiredPlugins(); 216 AnalysisEngine.instance.processRequiredPlugins();
217
218 var testFiles = getTestFiles();
217 expect(testFiles.containsKey('/main.dart'), isTrue, 219 expect(testFiles.containsKey('/main.dart'), isTrue,
218 reason: '`/main.dart` is missing in testFiles'); 220 reason: '`/main.dart` is missing in testFiles');
219 221
220 var provider = new MemoryResourceProvider(); 222 var provider = new MemoryResourceProvider();
221 testFiles.forEach((key, value) { 223 testFiles.forEach((key, value) {
222 var scheme = 'package:'; 224 var scheme = 'package:';
223 if (key.startsWith(scheme)) { 225 if (key.startsWith(scheme)) {
224 key = '/packages/${key.substring(scheme.length)}'; 226 key = '/packages/${key.substring(scheme.length)}';
225 } 227 }
226 provider.newFile(key, value); 228 provider.newFile(key, value);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 UriKind get uriKind => UriKind.DART_URI; 518 UriKind get uriKind => UriKind.DART_URI;
517 519
518 bool exists() => true; 520 bool exists() => true;
519 521
520 Source resolveRelative(Uri relativeUri) => 522 Source resolveRelative(Uri relativeUri) =>
521 throw new UnsupportedError('not expecting relative urls in dart: mocks'); 523 throw new UnsupportedError('not expecting relative urls in dart: mocks');
522 524
523 Uri resolveRelativeUri(Uri relativeUri) => 525 Uri resolveRelativeUri(Uri relativeUri) =>
524 throw new UnsupportedError('not expecting relative urls in dart: mocks'); 526 throw new UnsupportedError('not expecting relative urls in dart: mocks');
525 } 527 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698