| 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:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
| 10 import 'package:scheduled_test/descriptor.dart' as d; | 10 import 'package:scheduled_test/descriptor.dart' as d; |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 test('success 1', () {}); | 358 test('success 1', () {}); |
| 359 test('success 2', () {}); | 359 test('success 2', () {}); |
| 360 test('success 3', () {}); | 360 test('success 3', () {}); |
| 361 }, skip: true); | 361 }, skip: true); |
| 362 """, [ | 362 """, [ |
| 363 _start, | 363 _start, |
| 364 _allSuites(), | 364 _allSuites(), |
| 365 _suite(0), | 365 _suite(0), |
| 366 _testStart(1, "loading test.dart", groupIDs: []), | 366 _testStart(1, "loading test.dart", groupIDs: []), |
| 367 _testDone(1, hidden: true), | 367 _testDone(1, hidden: true), |
| 368 _group(2, testCount: 0), | 368 _group(2, testCount: 3), |
| 369 _group(3, name: "skip", parentID: 2, skip: true, testCount: 0, | 369 _group(3, name: "skip", parentID: 2, skip: true, testCount: 3, |
| 370 line: 6, column: 9), | 370 line: 6, column: 9), |
| 371 _testStart(4, "skip", groupIDs: [2, 3], skip: true, | 371 _testStart(4, "skip success 1", groupIDs: [2, 3], skip: true, |
| 372 line: 6, column: 9), | 372 line: 7, column: 11), |
| 373 _testDone(4, skipped: true), | 373 _testDone(4, skipped: true), |
| 374 _testStart(5, "skip success 2", groupIDs: [2, 3], skip: true, |
| 375 line: 8, column: 11), |
| 376 _testDone(5, skipped: true), |
| 377 _testStart(6, "skip success 3", groupIDs: [2, 3], skip: true, |
| 378 line: 9, column: 11), |
| 379 _testDone(6, skipped: true), |
| 374 _done() | 380 _done() |
| 375 ]); | 381 ]); |
| 376 }); | 382 }); |
| 377 | 383 |
| 378 test("reports the skip reason if available", () { | 384 test("reports the skip reason if available", () { |
| 379 _expectReport(""" | 385 _expectReport(""" |
| 380 test('skip 1', () {}, skip: 'some reason'); | 386 test('skip 1', () {}, skip: 'some reason'); |
| 381 test('skip 2', () {}, skip: 'or another'); | 387 test('skip 2', () {}, skip: 'or another'); |
| 382 """, [ | 388 """, [ |
| 383 _start, | 389 _start, |
| 384 _allSuites(), | 390 _allSuites(), |
| 385 _suite(0), | 391 _suite(0), |
| 386 _testStart(1, "loading test.dart", groupIDs: []), | 392 _testStart(1, "loading test.dart", groupIDs: []), |
| 387 _testDone(1, hidden: true), | 393 _testDone(1, hidden: true), |
| 388 _group(2, testCount: 2), | 394 _group(2, testCount: 2), |
| 389 _testStart(3, "skip 1", skip: "some reason", line: 6, column: 9), | 395 _testStart(3, "skip 1", skip: "some reason", line: 6, column: 9), |
| 390 _print(3, "Skip: some reason", type: "skip"), | 396 _print(3, "Skip: some reason", type: "skip"), |
| 391 _testDone(3, skipped: true), | 397 _testDone(3, skipped: true), |
| 392 _testStart(4, "skip 2", skip: "or another", line: 7, column: 9), | 398 _testStart(4, "skip 2", skip: "or another", line: 7, column: 9), |
| 393 _print(4, "Skip: or another", type: "skip"), | 399 _print(4, "Skip: or another", type: "skip"), |
| 394 _testDone(4, skipped: true), | 400 _testDone(4, skipped: true), |
| 395 _done() | 401 _done() |
| 396 ]); | 402 ]); |
| 397 }); | 403 }); |
| 404 |
| 405 test("runs skipped tests with --run-skipped", () { |
| 406 _expectReport(""" |
| 407 test('skip 1', () {}, skip: 'some reason'); |
| 408 test('skip 2', () {}, skip: 'or another'); |
| 409 """, [ |
| 410 _start, |
| 411 _allSuites(), |
| 412 _suite(0), |
| 413 _testStart(1, "loading test.dart", groupIDs: []), |
| 414 _testDone(1, hidden: true), |
| 415 _group(2, testCount: 2), |
| 416 _testStart(3, "skip 1", line: 6, column: 9), |
| 417 _testDone(3), |
| 418 _testStart(4, "skip 2", line: 7, column: 9), |
| 419 _testDone(4), |
| 420 _done() |
| 421 ], args: ["--run-skipped"]); |
| 422 }); |
| 398 }); | 423 }); |
| 399 | 424 |
| 400 group("reports line and column numbers for", () { | 425 group("reports line and column numbers for", () { |
| 401 test("the first call to setUpAll()", () { | 426 test("the first call to setUpAll()", () { |
| 402 _expectReport(""" | 427 _expectReport(""" |
| 403 setUpAll(() {}); | 428 setUpAll(() {}); |
| 404 setUpAll(() {}); | 429 setUpAll(() {}); |
| 405 setUpAll(() {}); | 430 setUpAll(() {}); |
| 406 test('success', () {}); | 431 test('success', () {}); |
| 407 """, [ | 432 """, [ |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 /// Returns the serialized metadata corresponding to [skip]. | 680 /// Returns the serialized metadata corresponding to [skip]. |
| 656 Map _metadata({skip}) { | 681 Map _metadata({skip}) { |
| 657 if (skip == true) { | 682 if (skip == true) { |
| 658 return {"skip": true, "skipReason": null}; | 683 return {"skip": true, "skipReason": null}; |
| 659 } else if (skip is String) { | 684 } else if (skip is String) { |
| 660 return {"skip": true, "skipReason": skip}; | 685 return {"skip": true, "skipReason": skip}; |
| 661 } else { | 686 } else { |
| 662 return {"skip": false, "skipReason": null}; | 687 return {"skip": false, "skipReason": null}; |
| 663 } | 688 } |
| 664 } | 689 } |
| OLD | NEW |