Chromium Code Reviews| 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; |
|
kevmoo
2015/08/26 21:20:55
now unused import
nweiz
2015/08/26 21:23:27
Done.
| |
| 11 import 'package:scheduled_test/descriptor.dart' as d; | 11 import 'package:scheduled_test/descriptor.dart' as d; |
| 12 import 'package:scheduled_test/scheduled_stream.dart'; | 12 import 'package:scheduled_test/scheduled_stream.dart'; |
| 13 import 'package:scheduled_test/scheduled_test.dart'; | 13 import 'package:scheduled_test/scheduled_test.dart'; |
| 14 import 'package:test/src/util/exit_codes.dart' as exit_codes; | 14 import 'package:test/src/util/exit_codes.dart' as exit_codes; |
| 15 | 15 |
| 16 import '../io.dart'; | 16 import '../io.dart'; |
| 17 | 17 |
| 18 final _success = """ | 18 final _success = """ |
| 19 import 'dart:async'; | 19 import 'dart:async'; |
| 20 | 20 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 return d.file("${i}_test.dart", _success); | 274 return d.file("${i}_test.dart", _success); |
| 275 })).create(); | 275 })).create(); |
| 276 | 276 |
| 277 var test = runTest([]); | 277 var test = runTest([]); |
| 278 test.stdout.expect(consumeThrough(contains("+3: All tests passed!"))); | 278 test.stdout.expect(consumeThrough(contains("+3: All tests passed!"))); |
| 279 test.shouldExit(0); | 279 test.shouldExit(0); |
| 280 }); | 280 }); |
| 281 | 281 |
| 282 test("directly", () { | 282 test("directly", () { |
| 283 d.file("test.dart", _success).create(); | 283 d.file("test.dart", _success).create(); |
| 284 var test = runDart([ | 284 var test = runDart(["test.dart"]); |
| 285 "--package-root=${p.join(packageDir, 'packages')}", | |
| 286 "test.dart" | |
| 287 ]); | |
| 288 | 285 |
| 289 test.stdout.expect(consumeThrough(contains("All tests passed!"))); | 286 test.stdout.expect(consumeThrough(contains("All tests passed!"))); |
| 290 test.shouldExit(0); | 287 test.shouldExit(0); |
| 291 }); | 288 }); |
| 292 | 289 |
| 293 // Regression test; this broke in 0.12.0-beta.9. | 290 // Regression test; this broke in 0.12.0-beta.9. |
| 294 test("on a file in a subdirectory", () { | 291 test("on a file in a subdirectory", () { |
| 295 d.dir("dir", [d.file("test.dart", _success)]).create(); | 292 d.dir("dir", [d.file("test.dart", _success)]).create(); |
| 296 | 293 |
| 297 var test = runTest(["dir/test.dart"]); | 294 var test = runTest(["dir/test.dart"]); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 324 return d.file("${i}_test.dart", _failure); | 321 return d.file("${i}_test.dart", _failure); |
| 325 })).create(); | 322 })).create(); |
| 326 | 323 |
| 327 var test = runTest([]); | 324 var test = runTest([]); |
| 328 test.stdout.expect(consumeThrough(contains("-3: Some tests failed."))); | 325 test.stdout.expect(consumeThrough(contains("-3: Some tests failed."))); |
| 329 test.shouldExit(1); | 326 test.shouldExit(1); |
| 330 }); | 327 }); |
| 331 | 328 |
| 332 test("directly", () { | 329 test("directly", () { |
| 333 d.file("test.dart", _failure).create(); | 330 d.file("test.dart", _failure).create(); |
| 334 var test = runDart([ | 331 var test = runDart(["test.dart"]); |
| 335 "--package-root=${p.join(packageDir, 'packages')}", | |
| 336 "test.dart" | |
| 337 ]); | |
| 338 test.stdout.expect(consumeThrough(contains("Some tests failed."))); | 332 test.stdout.expect(consumeThrough(contains("Some tests failed."))); |
| 339 test.shouldExit(255); | 333 test.shouldExit(255); |
| 340 }); | 334 }); |
| 341 }); | 335 }); |
| 342 | 336 |
| 343 test("runs tests even when a file fails to load", () { | 337 test("runs tests even when a file fails to load", () { |
| 344 d.file("test.dart", _success).create(); | 338 d.file("test.dart", _success).create(); |
| 345 | 339 |
| 346 var test = runTest(["test.dart", "nonexistent.dart"]); | 340 var test = runTest(["test.dart", "nonexistent.dart"]); |
| 347 test.stdout.expect(consumeThrough(contains("+1 -1: Some tests failed."))); | 341 test.stdout.expect(consumeThrough(contains("+1 -1: Some tests failed."))); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 673 d.file("test.dart", _success).create(); | 667 d.file("test.dart", _success).create(); |
| 674 | 668 |
| 675 var test = runTest(["--plain-name", "no match", "test.dart"]); | 669 var test = runTest(["--plain-name", "no match", "test.dart"]); |
| 676 test.stderr.expect( | 670 test.stderr.expect( |
| 677 consumeThrough(contains('No tests match "no match".'))); | 671 consumeThrough(contains('No tests match "no match".'))); |
| 678 test.shouldExit(exit_codes.data); | 672 test.shouldExit(exit_codes.data); |
| 679 }); | 673 }); |
| 680 }); | 674 }); |
| 681 }); | 675 }); |
| 682 } | 676 } |
| OLD | NEW |