| 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 // TODO(ahe): Copied from closure_conversion branch of kernel, remove this file | 5 // TODO(ahe): Copied from closure_conversion branch of kernel, remove this file |
| 6 // when closure_conversion is merged with master. | 6 // when closure_conversion is merged with master. |
| 7 | 7 |
| 8 library kernel.testing.kernel_chain; | 8 library kernel.testing.kernel_chain; |
| 9 | 9 |
| 10 import 'dart:async' show Future; | 10 import 'dart:async' show Future; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 185 } |
| 186 | 186 |
| 187 class Verify extends Step<Program, Program, TestContext> { | 187 class Verify extends Step<Program, Program, TestContext> { |
| 188 final bool fullCompile; | 188 final bool fullCompile; |
| 189 | 189 |
| 190 const Verify(this.fullCompile); | 190 const Verify(this.fullCompile); |
| 191 | 191 |
| 192 String get name => "verify"; | 192 String get name => "verify"; |
| 193 | 193 |
| 194 Future<Result<Program>> run(Program program, TestContext testContext) async { | 194 Future<Result<Program>> run(Program program, TestContext testContext) async { |
| 195 try { | 195 var errors = verifyProgram(program, isOutline: !fullCompile); |
| 196 verifyProgram(program, isOutline: !fullCompile); | 196 if (errors.isEmpty) { |
| 197 return pass(program); | 197 return pass(program); |
| 198 } catch (e, s) { | 198 } else { |
| 199 return new Result<Program>( | 199 return new Result<Program>( |
| 200 null, testContext.expectationSet["VerificationError"], e, s); | 200 null, testContext.expectationSet["VerificationError"], errors, null); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 class MatchExpectation extends Step<Program, Program, TestContext> { | 205 class MatchExpectation extends Step<Program, Program, TestContext> { |
| 206 final String suffix; | 206 final String suffix; |
| 207 | 207 |
| 208 // TODO(ahe): This is true by default which doesn't match well with the class | 208 // TODO(ahe): This is true by default which doesn't match well with the class |
| 209 // name. | 209 // name. |
| 210 final bool updateExpectations; | 210 final bool updateExpectations; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 356 |
| 357 Future openWrite(Uri uri, f(IOSink sink)) async { | 357 Future openWrite(Uri uri, f(IOSink sink)) async { |
| 358 IOSink sink = new File.fromUri(uri).openWrite(); | 358 IOSink sink = new File.fromUri(uri).openWrite(); |
| 359 try { | 359 try { |
| 360 await f(sink); | 360 await f(sink); |
| 361 } finally { | 361 } finally { |
| 362 await sink.close(); | 362 await sink.close(); |
| 363 } | 363 } |
| 364 print("Wrote $uri"); | 364 print("Wrote $uri"); |
| 365 } | 365 } |
| OLD | NEW |