| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 ===== asynchronous gap =========================== | 143 ===== asynchronous gap =========================== |
| 144 dart:async Future.Future.microtask | 144 dart:async Future.Future.microtask |
| 145 test.dart 12:15 main.<fn> | 145 test.dart 12:15 main.<fn> |
| 146 | 146 |
| 147 | 147 |
| 148 +0 -1: wait | 148 +0 -1: wait |
| 149 +1 -1: wait | 149 +1 -1: wait |
| 150 +1 -1: Some tests failed."""); | 150 +1 -1: Some tests failed."""); |
| 151 }); | 151 }); |
| 152 | 152 |
| 153 test("prints the full test name before an error", () { |
| 154 _expectReport(""" |
| 155 test( |
| 156 'really gosh dang long test name. Even longer than that. No, yet ' |
| 157 'longer. A little more... okay, that should do it.', |
| 158 () => throw new TestFailure('oh no'));""", |
| 159 """ |
| 160 +0: loading test.dart |
| 161 +0: really ... longer than that. No, yet longer. A little more... okay,
that should do it. |
| 162 +0 -1: really ... longer than that. No, yet longer. A little more... oka
y, that should do it. |
| 163 +0 -1: really gosh dang long test name. Even longer than that. No, yet l
onger. A little more... okay, that should do it. |
| 164 oh no |
| 165 test.dart 9:18 main.<fn> |
| 166 |
| 167 |
| 168 +0 -1: Some tests failed."""); |
| 169 }); |
| 170 |
| 153 group("print:", () { | 171 group("print:", () { |
| 154 test("handles multiple prints", () { | 172 test("handles multiple prints", () { |
| 155 _expectReport(""" | 173 _expectReport(""" |
| 156 test('test', () { | 174 test('test', () { |
| 157 print("one"); | 175 print("one"); |
| 158 print("two"); | 176 print("two"); |
| 159 print("three"); | 177 print("three"); |
| 160 print("four"); | 178 print("four"); |
| 161 });""", | 179 });""", |
| 162 """ | 180 """ |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 dart:async scheduleMicrotask | 265 dart:async scheduleMicrotask |
| 248 test.dart 10:11 main.<fn> | 266 test.dart 10:11 main.<fn> |
| 249 | 267 |
| 250 five | 268 five |
| 251 six | 269 six |
| 252 | 270 |
| 253 +0 -1: wait | 271 +0 -1: wait |
| 254 +1 -1: wait | 272 +1 -1: wait |
| 255 +1 -1: Some tests failed."""); | 273 +1 -1: Some tests failed."""); |
| 256 }); | 274 }); |
| 275 |
| 276 test("prints the full test name before a print", () { |
| 277 _expectReport(""" |
| 278 test( |
| 279 'really gosh dang long test name. Even longer than that. No, yet ' |
| 280 'longer. A little more... okay, that should do it.', |
| 281 () => print('hello'));""", |
| 282 """ |
| 283 +0: loading test.dart |
| 284 +0: really ... longer than that. No, yet longer. A little more... okay
, that should do it. |
| 285 +0: really gosh dang long test name. Even longer than that. No, yet lo
nger. A little more... okay, that should do it. |
| 286 hello |
| 287 |
| 288 +1: really ... longer than that. No, yet longer. A little more... okay
, that should do it. |
| 289 +1: All tests passed!"""); |
| 290 }); |
| 257 }); | 291 }); |
| 258 | 292 |
| 259 group("skip:", () { | 293 group("skip:", () { |
| 260 test("displays skipped tests separately", () { | 294 test("displays skipped tests separately", () { |
| 261 _expectReport(""" | 295 _expectReport(""" |
| 262 test('skip 1', () {}, skip: true); | 296 test('skip 1', () {}, skip: true); |
| 263 test('skip 2', () {}, skip: true); | 297 test('skip 2', () {}, skip: true); |
| 264 test('skip 3', () {}, skip: true);""", | 298 test('skip 3', () {}, skip: true);""", |
| 265 """ | 299 """ |
| 266 +0: loading test.dart | 300 +0: loading test.dart |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // Un-indent the expected string. | 420 // Un-indent the expected string. |
| 387 var indentation = expected.indexOf(new RegExp("[^ ]")); | 421 var indentation = expected.indexOf(new RegExp("[^ ]")); |
| 388 expected = expected.split("\n").map((line) { | 422 expected = expected.split("\n").map((line) { |
| 389 if (line.isEmpty) return line; | 423 if (line.isEmpty) return line; |
| 390 return line.substring(indentation); | 424 return line.substring(indentation); |
| 391 }).join("\n"); | 425 }).join("\n"); |
| 392 | 426 |
| 393 expect(actual, equals(expected)); | 427 expect(actual, equals(expected)); |
| 394 }), completes); | 428 }), completes); |
| 395 } | 429 } |
| OLD | NEW |