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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 void main() { | 344 void main() { |
345 test("timeout", () {}); | 345 test("timeout", () {}); |
346 } | 346 } |
347 '''); | 347 '''); |
348 | 348 |
349 var result = _runUnittest(["test.dart"]); | 349 var result = _runUnittest(["test.dart"]); |
350 expect(result.stdout, contains("Test timed out after 0 seconds.")); | 350 expect(result.stdout, contains("Test timed out after 0 seconds.")); |
351 expect(result.stdout, contains("-1: Some tests failed.")); | 351 expect(result.stdout, contains("-1: Some tests failed.")); |
352 }); | 352 }); |
353 | 353 |
| 354 test("respects top-level @Skip declarations", () { |
| 355 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(''' |
| 356 @Skip() |
| 357 |
| 358 import 'dart:async'; |
| 359 |
| 360 import 'package:test/test.dart'; |
| 361 |
| 362 void main() { |
| 363 test("fail", () => throw 'oh no'); |
| 364 } |
| 365 '''); |
| 366 |
| 367 var result = _runUnittest(["test.dart"]); |
| 368 expect(result.stdout, contains("+0 ~1: All tests skipped.")); |
| 369 }); |
| 370 |
354 group("flags:", () { | 371 group("flags:", () { |
355 test("with the --color flag, uses colors", () { | 372 test("with the --color flag, uses colors", () { |
356 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); | 373 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); |
357 var result = _runUnittest(["--color", "test.dart"]); | 374 var result = _runUnittest(["--color", "test.dart"]); |
358 // This is the color code for red. | 375 // This is the color code for red. |
359 expect(result.stdout, contains("\u001b[31m")); | 376 expect(result.stdout, contains("\u001b[31m")); |
360 }); | 377 }); |
361 | 378 |
362 group("with the --name flag,", () { | 379 group("with the --name flag,", () { |
363 test("selects tests with matching names", () { | 380 test("selects tests with matching names", () { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 }); | 479 }); |
463 }); | 480 }); |
464 }); | 481 }); |
465 } | 482 } |
466 | 483 |
467 ProcessResult _runUnittest(List<String> args) => | 484 ProcessResult _runUnittest(List<String> args) => |
468 runUnittest(args, workingDirectory: _sandbox); | 485 runUnittest(args, workingDirectory: _sandbox); |
469 | 486 |
470 ProcessResult _runDart(List<String> args) => | 487 ProcessResult _runDart(List<String> args) => |
471 runDart(args, workingDirectory: _sandbox); | 488 runDart(args, workingDirectory: _sandbox); |
OLD | NEW |