| 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 'package:scheduled_test/descriptor.dart' as d; | 7 import 'package:scheduled_test/descriptor.dart' as d; |
| 8 import 'package:scheduled_test/scheduled_stream.dart'; | 8 import 'package:scheduled_test/scheduled_stream.dart'; |
| 9 import 'package:scheduled_test/scheduled_test.dart'; | 9 import 'package:scheduled_test/scheduled_test.dart'; |
| 10 | 10 |
| 11 import '../io.dart'; | 11 import '../io.dart'; |
| 12 | 12 |
| 13 void main() { | 13 void main() { |
| 14 useSandbox(); | 14 useSandbox(); |
| 15 | 15 |
| 16 test("reports when no tests are run", () { | 16 test("reports when no tests are run", () { |
| 17 d.file("test.dart", "void main() {}").create(); | 17 d.file("test.dart", "void main() {}").create(); |
| 18 | 18 |
| 19 var test = runTest(["test.dart"], compact: true); | 19 var test = runTest(["test.dart"]); |
| 20 test.stdout.expect(consumeThrough(contains("No tests ran."))); | 20 test.stdout.expect(consumeThrough(contains("No tests ran."))); |
| 21 test.shouldExit(0); | 21 test.shouldExit(0); |
| 22 }); | 22 }); |
| 23 | 23 |
| 24 test("runs several successful tests and reports when each completes", () { | 24 test("runs several successful tests and reports when each completes", () { |
| 25 _expectReport(""" | 25 _expectReport(""" |
| 26 test('success 1', () {}); | 26 test('success 1', () {}); |
| 27 test('success 2', () {}); | 27 test('success 2', () {}); |
| 28 test('success 3', () {});""", | 28 test('success 3', () {});""", |
| 29 """ | 29 """ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 d.file("test.dart", """ | 61 d.file("test.dart", """ |
| 62 import 'dart:async'; | 62 import 'dart:async'; |
| 63 | 63 |
| 64 import 'package:test/test.dart'; | 64 import 'package:test/test.dart'; |
| 65 | 65 |
| 66 void main() { | 66 void main() { |
| 67 test("failure", () => throw "oh no"); | 67 test("failure", () => throw "oh no"); |
| 68 } | 68 } |
| 69 """).create(); | 69 """).create(); |
| 70 | 70 |
| 71 var test = runTest(["--verbose-trace", "test.dart"], compact: true); | 71 var test = runTest(["--verbose-trace", "test.dart"]); |
| 72 test.stdout.expect(consumeThrough(contains("dart:isolate-patch"))); | 72 test.stdout.expect(consumeThrough(contains("dart:isolate-patch"))); |
| 73 test.shouldExit(1); | 73 test.shouldExit(1); |
| 74 }); | 74 }); |
| 75 | 75 |
| 76 test("runs failing tests along with successful tests", () { | 76 test("runs failing tests along with successful tests", () { |
| 77 _expectReport(""" | 77 _expectReport(""" |
| 78 test('failure 1', () => throw new TestFailure('oh no')); | 78 test('failure 1', () => throw new TestFailure('oh no')); |
| 79 test('success 1', () {}); | 79 test('success 1', () {}); |
| 80 test('failure 2', () => throw new TestFailure('oh no')); | 80 test('failure 2', () => throw new TestFailure('oh no')); |
| 81 test('success 2', () {});""", | 81 test('success 2', () {});""", |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // Un-indent the expected string. | 333 // Un-indent the expected string. |
| 334 var indentation = expected.indexOf(new RegExp("[^ ]")); | 334 var indentation = expected.indexOf(new RegExp("[^ ]")); |
| 335 expected = expected.split("\n").map((line) { | 335 expected = expected.split("\n").map((line) { |
| 336 if (line.isEmpty) return line; | 336 if (line.isEmpty) return line; |
| 337 return line.substring(indentation); | 337 return line.substring(indentation); |
| 338 }).join("\n"); | 338 }).join("\n"); |
| 339 | 339 |
| 340 expect(actual, equals(expected)); | 340 expect(actual, equals(expected)); |
| 341 }); | 341 }); |
| 342 } | 342 } |
| OLD | NEW |