Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: pkg/front_end/test/fasta/testing/suite.dart

Issue 2914773003: add check of preconditions in `run` step. (Closed)
Patch Set: make it a crash instead Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 class Run extends Step<Uri, int, FastaContext> { 173 class Run extends Step<Uri, int, FastaContext> {
174 const Run(); 174 const Run();
175 175
176 String get name => "run"; 176 String get name => "run";
177 177
178 bool get isAsync => true; 178 bool get isAsync => true;
179 179
180 bool get isRuntime => true; 180 bool get isRuntime => true;
181 181
182 Future<Result<int>> run(Uri uri, FastaContext context) async { 182 Future<Result<int>> run(Uri uri, FastaContext context) async {
183 if (context.platformUri == null) {
184 throw "Executed `Run` step before initializing the context.";
185 }
183 File generated = new File.fromUri(uri); 186 File generated = new File.fromUri(uri);
184 StdioProcess process; 187 StdioProcess process;
185 try { 188 try {
186 await context.ensurePlatformUris();
187 var platformDill = context.platformUri.toFilePath(); 189 var platformDill = context.platformUri.toFilePath();
188 var args = ['--platform=$platformDill', generated.path, "Hello, World!"]; 190 var args = ['--platform=$platformDill', generated.path, "Hello, World!"];
189 process = await StdioProcess.run(context.vm.toFilePath(), args); 191 process = await StdioProcess.run(context.vm.toFilePath(), args);
190 print(process.output); 192 print(process.output);
191 } finally { 193 } finally {
192 generated.parent.delete(recursive: true); 194 generated.parent.delete(recursive: true);
193 } 195 }
194 return process.toResult(); 196 return process.toResult();
195 } 197 }
196 } 198 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return fail(null, instrumentation.problemsAsString); 258 return fail(null, instrumentation.problemsAsString);
257 } 259 }
258 } 260 }
259 } 261 }
260 } on InputError catch (e, s) { 262 } on InputError catch (e, s) {
261 return fail(null, e.error, s); 263 return fail(null, e.error, s);
262 } 264 }
263 return pass(p); 265 return pass(p);
264 } 266 }
265 } 267 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698