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 fasta.testing.kernel_chain; | 8 library fasta.testing.kernel_chain; |
9 | 9 |
10 import 'dart:async' show Future; | 10 import 'dart:async' show Future; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } else { | 102 } else { |
103 return pass(program); | 103 return pass(program); |
104 } | 104 } |
105 } | 105 } |
106 if (updateExpectations) { | 106 if (updateExpectations) { |
107 await openWrite(expectedFile.uri, (IOSink sink) { | 107 await openWrite(expectedFile.uri, (IOSink sink) { |
108 sink.writeln("$buffer".trim()); | 108 sink.writeln("$buffer".trim()); |
109 }); | 109 }); |
110 return pass(program); | 110 return pass(program); |
111 } else { | 111 } else { |
112 return fail( | 112 return fail(program, """ |
113 program, | |
114 """ | |
115 Please create file ${expectedFile.path} with this content: | 113 Please create file ${expectedFile.path} with this content: |
116 $buffer"""); | 114 $buffer"""); |
117 } | 115 } |
118 } | 116 } |
119 } | 117 } |
120 | 118 |
121 class WriteDill extends Step<Program, Uri, ChainContext> { | 119 class WriteDill extends Step<Program, Uri, ChainContext> { |
122 const WriteDill(); | 120 const WriteDill(); |
123 | 121 |
124 String get name => "write .dill"; | 122 String get name => "write .dill"; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 239 |
242 Future openWrite(Uri uri, f(IOSink sink)) async { | 240 Future openWrite(Uri uri, f(IOSink sink)) async { |
243 IOSink sink = new File.fromUri(uri).openWrite(); | 241 IOSink sink = new File.fromUri(uri).openWrite(); |
244 try { | 242 try { |
245 await f(sink); | 243 await f(sink); |
246 } finally { | 244 } finally { |
247 await sink.close(); | 245 await sink.close(); |
248 } | 246 } |
249 print("Wrote $uri"); | 247 print("Wrote $uri"); |
250 } | 248 } |
OLD | NEW |