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

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

Issue 2404703002: Fix more tests under windows (Closed)
Patch Set: Created 4 years, 2 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/test/src/summary/pub_summary_test.dart ('k') | no next file » | 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 // 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/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 28 matching lines...) Expand all
39 /// create a file like: 39 /// create a file like:
40 /// 40 ///
41 /// addFile(''' 41 /// addFile('''
42 /// String x = /*error:STATIC_TYPE_ERROR*/3; 42 /// String x = /*error:STATIC_TYPE_ERROR*/3;
43 /// '''); 43 /// ''');
44 /// check(); 44 /// check();
45 /// 45 ///
46 /// For a single file, you may also use [checkFile]. 46 /// For a single file, you may also use [checkFile].
47 void addFile(String content, {String name: '/main.dart'}) { 47 void addFile(String content, {String name: '/main.dart'}) {
48 name = name.replaceFirst('^package:', '/packages/'); 48 name = name.replaceFirst('^package:', '/packages/');
49 files.newFile(name, content); 49 files.newFile(files.convertPath(name), content);
50 } 50 }
51 51
52 /// Run the checker on a program, staring from '/main.dart', and verifies that 52 /// Run the checker on a program, staring from '/main.dart', and verifies that
53 /// errors/warnings/hints match the expected value. 53 /// errors/warnings/hints match the expected value.
54 /// 54 ///
55 /// See [addFile] for more information about how to encode expectations in 55 /// See [addFile] for more information about how to encode expectations in
56 /// the file text. 56 /// the file text.
57 /// 57 ///
58 /// Returns the main resolved library. This can be used for further checks. 58 /// Returns the main resolved library. This can be used for further checks.
59 CompilationUnit check( 59 CompilationUnit check(
60 {bool implicitCasts: true, 60 {bool implicitCasts: true,
61 bool implicitDynamic: true, 61 bool implicitDynamic: true,
62 List<String> nonnullableTypes: AnalysisOptionsImpl.NONNULLABLE_TYPES}) { 62 List<String> nonnullableTypes: AnalysisOptionsImpl.NONNULLABLE_TYPES}) {
63 _checkCalled = true; 63 _checkCalled = true;
64 64
65 expect(files.getFile('/main.dart').exists, true, 65 expect(files.getFile(files.convertPath('/main.dart')).exists, true,
66 reason: '`/main.dart` is missing'); 66 reason: '`/main.dart` is missing');
67 67
68 var uriResolver = new _TestUriResolver(files); 68 var uriResolver = new _TestUriResolver(files);
69 // Enable task model strong mode 69 // Enable task model strong mode
70 var context = AnalysisEngine.instance.createAnalysisContext(); 70 var context = AnalysisEngine.instance.createAnalysisContext();
71 AnalysisOptionsImpl options = context.analysisOptions as AnalysisOptionsImpl; 71 AnalysisOptionsImpl options = context.analysisOptions as AnalysisOptionsImpl;
72 options.strongMode = true; 72 options.strongMode = true;
73 options.strongModeHints = true; 73 options.strongModeHints = true;
74 options.implicitCasts = implicitCasts; 74 options.implicitCasts = implicitCasts;
75 options.implicitDynamic = implicitDynamic; 75 options.implicitDynamic = implicitDynamic;
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 @override 400 @override
401 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 401 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
402 if (uri.scheme == 'package') { 402 if (uri.scheme == 'package') {
403 return (provider.getResource('/packages/' + uri.path) as File) 403 return (provider.getResource('/packages/' + uri.path) as File)
404 .createSource(uri); 404 .createSource(uri);
405 } 405 }
406 return super.resolveAbsolute(uri, actualUri); 406 return super.resolveAbsolute(uri, actualUri);
407 } 407 }
408 } 408 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/pub_summary_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698