| OLD | NEW |
| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 }); | 288 }); |
| 289 |
| 290 // Regression test; this broke in 0.12.0-beta.9. |
| 291 test("on a file in a subdirectory", () { |
| 292 new Directory(p.join(_sandbox, "dir")).createSync(); |
| 293 new File(p.join(_sandbox, "dir", "test.dart")) |
| 294 .writeAsStringSync(_success); |
| 295 var result = _runUnittest(["dir/test.dart"]); |
| 296 expect(result.exitCode, equals(0)); |
| 297 }); |
| 289 }); | 298 }); |
| 290 | 299 |
| 291 group("runs failing tests", () { | 300 group("runs failing tests", () { |
| 292 test("defined in a single file", () { | 301 test("defined in a single file", () { |
| 293 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); | 302 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); |
| 294 var result = _runUnittest(["test.dart"]); | 303 var result = _runUnittest(["test.dart"]); |
| 295 expect(result.exitCode, equals(1)); | 304 expect(result.exitCode, equals(1)); |
| 296 }); | 305 }); |
| 297 | 306 |
| 298 test("defined in a directory", () { | 307 test("defined in a directory", () { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 }); | 488 }); |
| 480 }); | 489 }); |
| 481 }); | 490 }); |
| 482 } | 491 } |
| 483 | 492 |
| 484 ProcessResult _runUnittest(List<String> args) => | 493 ProcessResult _runUnittest(List<String> args) => |
| 485 runUnittest(args, workingDirectory: _sandbox); | 494 runUnittest(args, workingDirectory: _sandbox); |
| 486 | 495 |
| 487 ProcessResult _runDart(List<String> args) => | 496 ProcessResult _runDart(List<String> args) => |
| 488 runDart(args, workingDirectory: _sandbox); | 497 runDart(args, workingDirectory: _sandbox); |
| OLD | NEW |