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

Side by Side Diff: test/runner/runner_test.dart

Issue 1086083006: Properly set the exit code for failing tests run directly. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 8 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 | « lib/test.dart ('k') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 @TestOn("vm") 5 @TestOn("vm")
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 expect(result.exitCode, equals(0)); 278 expect(result.exitCode, equals(0));
279 }); 279 });
280 280
281 test("directly", () { 281 test("directly", () {
282 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); 282 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
283 var result = _runDart([ 283 var result = _runDart([
284 "--package-root=${p.join(packageDir, 'packages')}", 284 "--package-root=${p.join(packageDir, 'packages')}",
285 "test.dart" 285 "test.dart"
286 ]); 286 ]);
287 expect(result.stdout, contains("All tests passed!")); 287 expect(result.stdout, contains("All tests passed!"));
288 expect(result.exitCode, equals(0));
288 }); 289 });
289 290
290 // Regression test; this broke in 0.12.0-beta.9. 291 // Regression test; this broke in 0.12.0-beta.9.
291 test("on a file in a subdirectory", () { 292 test("on a file in a subdirectory", () {
292 new Directory(p.join(_sandbox, "dir")).createSync(); 293 new Directory(p.join(_sandbox, "dir")).createSync();
293 new File(p.join(_sandbox, "dir", "test.dart")) 294 new File(p.join(_sandbox, "dir", "test.dart"))
294 .writeAsStringSync(_success); 295 .writeAsStringSync(_success);
295 var result = _runUnittest(["dir/test.dart"]); 296 var result = _runUnittest(["dir/test.dart"]);
296 expect(result.exitCode, equals(0)); 297 expect(result.exitCode, equals(0));
297 }); 298 });
(...skipping 27 matching lines...) Expand all
325 expect(result.exitCode, equals(1)); 326 expect(result.exitCode, equals(1));
326 }); 327 });
327 328
328 test("directly", () { 329 test("directly", () {
329 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); 330 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure);
330 var result = _runDart([ 331 var result = _runDart([
331 "--package-root=${p.join(packageDir, 'packages')}", 332 "--package-root=${p.join(packageDir, 'packages')}",
332 "test.dart" 333 "test.dart"
333 ]); 334 ]);
334 expect(result.stdout, contains("Some tests failed.")); 335 expect(result.stdout, contains("Some tests failed."));
336 expect(result.exitCode, isNot(equals(0)));
335 }); 337 });
336 }); 338 });
337 339
338 test("runs tests even when a file fails to load", () { 340 test("runs tests even when a file fails to load", () {
339 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); 341 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
340 var result = _runUnittest(["test.dart", "nonexistent.dart"]); 342 var result = _runUnittest(["test.dart", "nonexistent.dart"]);
341 expect(result.stdout, contains("+1 -1: Some tests failed.")); 343 expect(result.stdout, contains("+1 -1: Some tests failed."));
342 expect(result.exitCode, equals(1)); 344 expect(result.exitCode, equals(1));
343 }); 345 });
344 346
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 }); 659 });
658 }); 660 });
659 }); 661 });
660 } 662 }
661 663
662 ProcessResult _runUnittest(List<String> args) => 664 ProcessResult _runUnittest(List<String> args) =>
663 runUnittest(args, workingDirectory: _sandbox); 665 runUnittest(args, workingDirectory: _sandbox);
664 666
665 ProcessResult _runDart(List<String> args) => 667 ProcessResult _runDart(List<String> args) =>
666 runDart(args, workingDirectory: _sandbox); 668 runDart(args, workingDirectory: _sandbox);
OLDNEW
« no previous file with comments | « lib/test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698