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 test(name, () { | 83 test(name, () { |
84 expect(testFiles.containsKey('/main.dart'), isTrue, | 84 expect(testFiles.containsKey('/main.dart'), isTrue, |
85 reason: '`/main.dart` is missing in testFiles'); | 85 reason: '`/main.dart` is missing in testFiles'); |
86 | 86 |
87 var provider = createTestResourceProvider(testFiles); | 87 var provider = createTestResourceProvider(testFiles); |
88 var uriResolver = new TestUriResolver(provider); | 88 var uriResolver = new TestUriResolver(provider); |
| 89 // Enable task model strong mode |
| 90 AnalysisEngine.instance.useTaskModel = true; |
89 var context = AnalysisEngine.instance.createAnalysisContext(); | 91 var context = AnalysisEngine.instance.createAnalysisContext(); |
| 92 context.analysisOptions.strongMode = true; |
90 context.sourceFactory = createSourceFactory( | 93 context.sourceFactory = createSourceFactory( |
91 new SourceResolverOptions( | 94 new SourceResolverOptions( |
92 customUrlMappings: customUrlMappings, | 95 customUrlMappings: customUrlMappings, |
93 useMockSdk: sdkDir == null, | 96 useMockSdk: sdkDir == null, |
94 dartSdkPath: sdkDir), | 97 dartSdkPath: sdkDir), |
95 fileResolvers: [uriResolver]); | 98 fileResolvers: [uriResolver]); |
96 | 99 |
97 var checker = new StrongChecker( | 100 var checker = new StrongChecker( |
98 context, | 101 context, |
99 new StrongModeOptions( | 102 new StrongModeOptions( |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 expect(tokens[1], "should", reason: 'invalid error descriptor'); | 280 expect(tokens[1], "should", reason: 'invalid error descriptor'); |
278 expect(tokens[2], "be", reason: 'invalid error descriptor'); | 281 expect(tokens[2], "be", reason: 'invalid error descriptor'); |
279 if (tokens[0] == "pass") return null; | 282 if (tokens[0] == "pass") return null; |
280 // TODO(leafp) For now, we just use whatever the current expectation is, | 283 // TODO(leafp) For now, we just use whatever the current expectation is, |
281 // eventually we could do more automated reporting here. | 284 // eventually we could do more automated reporting here. |
282 return _parse(tokens[0]); | 285 return _parse(tokens[0]); |
283 } | 286 } |
284 | 287 |
285 String toString() => '$level $typeName'; | 288 String toString() => '$level $typeName'; |
286 } | 289 } |
OLD | NEW |