| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library fasta.testing.suite; | 5 library fasta.testing.suite; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'dart:io' show File; | 9 import 'dart:io' show File; |
| 10 | 10 |
| 11 import 'dart:convert' show JSON; | 11 import 'dart:convert' show JSON; |
| 12 | 12 |
| 13 import 'package:front_end/physical_file_system.dart'; | 13 import 'package:front_end/physical_file_system.dart' show PhysicalFileSystem; |
| 14 |
| 14 import 'package:front_end/src/fasta/testing/validating_instrumentation.dart' | 15 import 'package:front_end/src/fasta/testing/validating_instrumentation.dart' |
| 15 show ValidatingInstrumentation; | 16 show ValidatingInstrumentation; |
| 16 | 17 |
| 17 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart'; | 18 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart' |
| 19 show computeDartVm, computePatchedSdk; |
| 18 | 20 |
| 19 import 'package:kernel/ast.dart' show Program; | 21 import 'package:kernel/ast.dart' show Program; |
| 20 | 22 |
| 21 import 'package:testing/testing.dart' | 23 import 'package:testing/testing.dart' |
| 22 show | 24 show |
| 23 Chain, | 25 Chain, |
| 24 ChainContext, | 26 ChainContext, |
| 25 ExpectationSet, | 27 ExpectationSet, |
| 26 Result, | 28 Result, |
| 27 Step, | 29 Step, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // cloning it. | 136 // cloning it. |
| 135 // TODO(sigmund): investigate alternatives to this approach. | 137 // TODO(sigmund): investigate alternatives to this approach. |
| 136 return loadProgramFromBytes(outlineBytes); | 138 return loadProgramFromBytes(outlineBytes); |
| 137 } | 139 } |
| 138 | 140 |
| 139 static Future<FastaContext> create( | 141 static Future<FastaContext> create( |
| 140 Chain suite, Map<String, String> environment) async { | 142 Chain suite, Map<String, String> environment) async { |
| 141 Uri sdk = await computePatchedSdk(); | 143 Uri sdk = await computePatchedSdk(); |
| 142 Uri vm = computeDartVm(sdk); | 144 Uri vm = computeDartVm(sdk); |
| 143 Uri packages = Uri.base.resolve(".packages"); | 145 Uri packages = Uri.base.resolve(".packages"); |
| 144 TranslateUri uriTranslator = | 146 TranslateUri uriTranslator = await TranslateUri |
| 145 await TranslateUri.parse(PhysicalFileSystem.instance, packages); | 147 .parse(PhysicalFileSystem.instance, sdk, packages: packages); |
| 146 bool strongMode = environment.containsKey(STRONG_MODE); | 148 bool strongMode = environment.containsKey(STRONG_MODE); |
| 147 bool updateExpectations = environment["updateExpectations"] == "true"; | 149 bool updateExpectations = environment["updateExpectations"] == "true"; |
| 148 bool updateComments = environment["updateComments"] == "true"; | 150 bool updateComments = environment["updateComments"] == "true"; |
| 149 bool skipVm = environment["skipVm"] == "true"; | 151 bool skipVm = environment["skipVm"] == "true"; |
| 150 String astKindString = environment[AST_KIND_INDEX]; | 152 String astKindString = environment[AST_KIND_INDEX]; |
| 151 AstKind astKind = | 153 AstKind astKind = |
| 152 astKindString == null ? null : AstKind.values[int.parse(astKindString)]; | 154 astKindString == null ? null : AstKind.values[int.parse(astKindString)]; |
| 153 return new FastaContext( | 155 return new FastaContext( |
| 154 vm, | 156 vm, |
| 155 strongMode, | 157 strongMode, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 return fail(null, instrumentation.problemsAsString); | 240 return fail(null, instrumentation.problemsAsString); |
| 239 } | 241 } |
| 240 } | 242 } |
| 241 } | 243 } |
| 242 } on InputError catch (e, s) { | 244 } on InputError catch (e, s) { |
| 243 return fail(null, e.error, s); | 245 return fail(null, e.error, s); |
| 244 } | 246 } |
| 245 return pass(p); | 247 return pass(p); |
| 246 } | 248 } |
| 247 } | 249 } |
| OLD | NEW |