| 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 'package:analyzer/file_system/file_system.dart'; | 7 import 'package:analyzer/file_system/file_system.dart'; |
| 8 import 'package:analyzer/file_system/memory_file_system.dart'; | 8 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | 10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 /// testChecker({ | 41 /// testChecker({ |
| 42 /// '/main.dart': ''' | 42 /// '/main.dart': ''' |
| 43 /// testMethod() { | 43 /// testMethod() { |
| 44 /// dynamic x = /*warning:Box*/3; | 44 /// dynamic x = /*warning:Box*/3; |
| 45 /// } | 45 /// } |
| 46 /// ''' | 46 /// ''' |
| 47 /// }); | 47 /// }); |
| 48 /// | 48 /// |
| 49 CheckerResults testChecker(Map<String, String> testFiles, {String sdkDir, | 49 CheckerResults testChecker(Map<String, String> testFiles, {String sdkDir, |
| 50 customUrlMappings: const {}, | 50 customUrlMappings: const {}, |
| 51 CheckerReporter createReporter(AnalysisContext context), | 51 CheckerReporter createReporter(AnalysisContext context), relaxedCasts: true, |
| 52 covariantGenerics: true, relaxedCasts: true, | |
| 53 inferDownwards: RulesOptions.inferDownwardsDefault, | 52 inferDownwards: RulesOptions.inferDownwardsDefault, |
| 54 inferFromOverrides: ResolverOptions.inferFromOverridesDefault, | 53 inferFromOverrides: ResolverOptions.inferFromOverridesDefault, |
| 55 inferTransitively: ResolverOptions.inferTransitivelyDefault, | 54 inferTransitively: ResolverOptions.inferTransitivelyDefault, |
| 56 nonnullableTypes: TypeOptions.NONNULLABLE_TYPES}) { | 55 nonnullableTypes: TypeOptions.NONNULLABLE_TYPES}) { |
| 57 expect(testFiles.containsKey('/main.dart'), isTrue, | 56 expect(testFiles.containsKey('/main.dart'), isTrue, |
| 58 reason: '`/main.dart` is missing in testFiles'); | 57 reason: '`/main.dart` is missing in testFiles'); |
| 59 | 58 |
| 60 var provider = createTestResourceProvider(testFiles); | 59 var provider = createTestResourceProvider(testFiles); |
| 61 var uriResolver = new TestUriResolver(provider); | 60 var uriResolver = new TestUriResolver(provider); |
| 62 | 61 |
| 63 var options = new CompilerOptions( | 62 var options = new CompilerOptions( |
| 64 covariantGenerics: covariantGenerics, | |
| 65 relaxedCasts: relaxedCasts, | 63 relaxedCasts: relaxedCasts, |
| 66 inferDownwards: inferDownwards, | 64 inferDownwards: inferDownwards, |
| 67 inferFromOverrides: inferFromOverrides, | 65 inferFromOverrides: inferFromOverrides, |
| 68 inferTransitively: inferTransitively, | 66 inferTransitively: inferTransitively, |
| 69 nonnullableTypes: nonnullableTypes, | 67 nonnullableTypes: nonnullableTypes, |
| 70 useMockSdk: sdkDir == null, | 68 useMockSdk: sdkDir == null, |
| 71 dartSdkPath: sdkDir, | 69 dartSdkPath: sdkDir, |
| 72 runtimeDir: '/dev_compiler_runtime/', | 70 runtimeDir: '/dev_compiler_runtime/', |
| 73 entryPointFile: '/main.dart', | 71 entryPointFile: '/main.dart', |
| 74 customUrlMappings: customUrlMappings); | 72 customUrlMappings: customUrlMappings); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 expect(tokens[1], "should", reason: 'invalid error descriptor'); | 296 expect(tokens[1], "should", reason: 'invalid error descriptor'); |
| 299 expect(tokens[2], "be", reason: 'invalid error descriptor'); | 297 expect(tokens[2], "be", reason: 'invalid error descriptor'); |
| 300 if (tokens[0] == "pass") return null; | 298 if (tokens[0] == "pass") return null; |
| 301 // TODO(leafp) For now, we just use whatever the current expectation is, | 299 // TODO(leafp) For now, we just use whatever the current expectation is, |
| 302 // eventually we could do more automated reporting here. | 300 // eventually we could do more automated reporting here. |
| 303 return _parse(tokens[0]); | 301 return _parse(tokens[0]); |
| 304 } | 302 } |
| 305 | 303 |
| 306 String toString() => '$level $type'; | 304 String toString() => '$level $type'; |
| 307 } | 305 } |
| OLD | NEW |