| 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 test.kernel.reify.suite; | 5 library test.kernel.reify.suite; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'dart:io' show Directory, File, IOSink; | 9 import 'dart:io' show Directory, File, IOSink; |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } else { | 89 } else { |
| 90 return pass(program); | 90 return pass(program); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 if (updateExpectations) { | 93 if (updateExpectations) { |
| 94 await openWrite(expectedFile.uri, (IOSink sink) { | 94 await openWrite(expectedFile.uri, (IOSink sink) { |
| 95 sink.writeln("$buffer".trim()); | 95 sink.writeln("$buffer".trim()); |
| 96 }); | 96 }); |
| 97 return pass(program); | 97 return pass(program); |
| 98 } else { | 98 } else { |
| 99 return fail( | 99 return fail(program, """ |
| 100 program, | |
| 101 """ | |
| 102 Please create file ${expectedFile.path} with this content: | 100 Please create file ${expectedFile.path} with this content: |
| 103 $buffer"""); | 101 $buffer"""); |
| 104 } | 102 } |
| 105 } | 103 } |
| 106 } | 104 } |
| 107 | 105 |
| 108 class WriteDill extends Step<Program, Uri, ChainContext> { | 106 class WriteDill extends Step<Program, Uri, ChainContext> { |
| 109 const WriteDill(); | 107 const WriteDill(); |
| 110 | 108 |
| 111 String get name => "write .dill"; | 109 String get name => "write .dill"; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 187 |
| 190 Future openWrite(Uri uri, f(IOSink sink)) async { | 188 Future openWrite(Uri uri, f(IOSink sink)) async { |
| 191 IOSink sink = new File.fromUri(uri).openWrite(); | 189 IOSink sink = new File.fromUri(uri).openWrite(); |
| 192 try { | 190 try { |
| 193 await f(sink); | 191 await f(sink); |
| 194 } finally { | 192 } finally { |
| 195 await sink.close(); | 193 await sink.close(); |
| 196 } | 194 } |
| 197 print("Wrote $uri"); | 195 print("Wrote $uri"); |
| 198 } | 196 } |
| OLD | NEW |