OLD | NEW |
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 dev_compiler.src.testing; | 5 library dev_compiler.src.testing; |
6 | 6 |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 import 'package:analyzer/file_system/file_system.dart'; | 8 import 'package:analyzer/file_system/file_system.dart'; |
9 import 'package:analyzer/file_system/memory_file_system.dart'; | 9 import 'package:analyzer/file_system/memory_file_system.dart'; |
10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 inferDownwards: StrongModeOptions.inferDownwardsDefault, | 79 inferDownwards: StrongModeOptions.inferDownwardsDefault, |
80 inferFromOverrides: StrongModeOptions.inferFromOverridesDefault, | 80 inferFromOverrides: StrongModeOptions.inferFromOverridesDefault, |
81 inferTransitively: StrongModeOptions.inferTransitivelyDefault, | 81 inferTransitively: StrongModeOptions.inferTransitivelyDefault, |
82 nonnullableTypes: StrongModeOptions.NONNULLABLE_TYPES}) { | 82 nonnullableTypes: StrongModeOptions.NONNULLABLE_TYPES}) { |
83 expect(testFiles.containsKey('/main.dart'), isTrue, | 83 expect(testFiles.containsKey('/main.dart'), isTrue, |
84 reason: '`/main.dart` is missing in testFiles'); | 84 reason: '`/main.dart` is missing in testFiles'); |
85 | 85 |
86 var provider = createTestResourceProvider(testFiles); | 86 var provider = createTestResourceProvider(testFiles); |
87 var uriResolver = new TestUriResolver(provider); | 87 var uriResolver = new TestUriResolver(provider); |
88 var context = AnalysisEngine.instance.createAnalysisContext(); | 88 var context = AnalysisEngine.instance.createAnalysisContext(); |
89 context.sourceFactory = createSourceFactory(new SourceResolverOptions( | 89 context.sourceFactory = createSourceFactory( |
90 customUrlMappings: customUrlMappings, | 90 new SourceResolverOptions( |
91 useMockSdk: sdkDir == null, | 91 customUrlMappings: customUrlMappings, |
92 dartSdkPath: sdkDir), fileResolvers: [uriResolver]); | 92 useMockSdk: sdkDir == null, |
| 93 dartSdkPath: sdkDir), |
| 94 fileResolvers: [uriResolver]); |
93 | 95 |
94 var checker = new StrongChecker( | 96 var checker = new StrongChecker( |
95 context, | 97 context, |
96 new StrongModeOptions( | 98 new StrongModeOptions( |
97 relaxedCasts: relaxedCasts, | 99 relaxedCasts: relaxedCasts, |
98 inferDownwards: inferDownwards, | 100 inferDownwards: inferDownwards, |
99 inferFromOverrides: inferFromOverrides, | 101 inferFromOverrides: inferFromOverrides, |
100 inferTransitively: inferTransitively, | 102 inferTransitively: inferTransitively, |
101 nonnullableTypes: nonnullableTypes, | 103 nonnullableTypes: nonnullableTypes, |
102 hints: true)); | 104 hints: true)); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 expect(tokens[1], "should", reason: 'invalid error descriptor'); | 274 expect(tokens[1], "should", reason: 'invalid error descriptor'); |
273 expect(tokens[2], "be", reason: 'invalid error descriptor'); | 275 expect(tokens[2], "be", reason: 'invalid error descriptor'); |
274 if (tokens[0] == "pass") return null; | 276 if (tokens[0] == "pass") return null; |
275 // TODO(leafp) For now, we just use whatever the current expectation is, | 277 // TODO(leafp) For now, we just use whatever the current expectation is, |
276 // eventually we could do more automated reporting here. | 278 // eventually we could do more automated reporting here. |
277 return _parse(tokens[0]); | 279 return _parse(tokens[0]); |
278 } | 280 } |
279 | 281 |
280 String toString() => '$level $typeName'; | 282 String toString() => '$level $typeName'; |
281 } | 283 } |
OLD | NEW |