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 | 8 |
9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
10 import 'package:test/src/util/io.dart'; | 10 import 'package:test/src/util/io.dart'; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 +0 -1: success 1 | 90 +0 -1: success 1 |
91 +1 -1: failure 2 | 91 +1 -1: failure 2 |
92 +1 -2: failure 2 | 92 +1 -2: failure 2 |
93 oh no | 93 oh no |
94 test.dart 8:33 main.<fn> | 94 test.dart 8:33 main.<fn> |
95 | 95 |
96 +1 -2: success 2 | 96 +1 -2: success 2 |
97 +2 -2: Some tests failed."""); | 97 +2 -2: Some tests failed."""); |
98 }); | 98 }); |
99 | 99 |
| 100 test("always prints the full test name", () { |
| 101 _expectReport(""" |
| 102 test( |
| 103 'really gosh dang long test name. Even longer than that. No, yet ' |
| 104 'longer. A little more... okay, that should do it.', |
| 105 () {});""", |
| 106 """ |
| 107 +0: really gosh dang long test name. Even longer than that. No, yet long
er. A little more... okay, that should do it. |
| 108 +1: All tests passed!"""); |
| 109 }); |
| 110 |
100 test("gracefully handles multiple test failures in a row", () { | 111 test("gracefully handles multiple test failures in a row", () { |
101 _expectReport(""" | 112 _expectReport(""" |
102 // This completer ensures that the test isolate isn't killed until all | 113 // This completer ensures that the test isolate isn't killed until all |
103 // errors have been thrown. | 114 // errors have been thrown. |
104 var completer = new Completer(); | 115 var completer = new Completer(); |
105 test('failures', () { | 116 test('failures', () { |
106 new Future.microtask(() => throw 'first error'); | 117 new Future.microtask(() => throw 'first error'); |
107 new Future.microtask(() => throw 'second error'); | 118 new Future.microtask(() => throw 'second error'); |
108 new Future.microtask(() => throw 'third error'); | 119 new Future.microtask(() => throw 'third error'); |
109 new Future.microtask(completer.complete); | 120 new Future.microtask(completer.complete); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // Un-indent the expected string. | 341 // Un-indent the expected string. |
331 var indentation = expected.indexOf(new RegExp("[^ ]")); | 342 var indentation = expected.indexOf(new RegExp("[^ ]")); |
332 expected = expected.split("\n").map((line) { | 343 expected = expected.split("\n").map((line) { |
333 if (line.isEmpty) return line; | 344 if (line.isEmpty) return line; |
334 return line.substring(indentation); | 345 return line.substring(indentation); |
335 }).join("\n"); | 346 }).join("\n"); |
336 | 347 |
337 expect(actual, equals(expected)); | 348 expect(actual, equals(expected)); |
338 }), completes); | 349 }), completes); |
339 } | 350 } |
OLD | NEW |