| 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'; | |
| 8 | |
| 9 import 'package:scheduled_test/descriptor.dart' as d; | 7 import 'package:scheduled_test/descriptor.dart' as d; |
| 10 import 'package:scheduled_test/scheduled_stream.dart'; | 8 import 'package:scheduled_test/scheduled_stream.dart'; |
| 11 import 'package:scheduled_test/scheduled_test.dart'; | 9 import 'package:scheduled_test/scheduled_test.dart'; |
| 12 import 'package:test/src/util/io.dart'; | 10 import 'package:test/src/util/io.dart'; |
| 13 | 11 |
| 14 import '../io.dart'; | 12 import '../io.dart'; |
| 15 | 13 |
| 16 void main() { | 14 void main() { |
| 17 useSandbox(); | 15 useSandbox(); |
| 18 | 16 |
| 19 group("for suite", () { | 17 group("for suite", () { |
| 20 test("runs a test suite on a matching platform", () { | 18 test("runs a test suite on a matching platform", () { |
| 21 _writeTestFile("vm_test.dart", suiteTestOn: "vm"); | 19 _writeTestFile("vm_test.dart", suiteTestOn: "vm"); |
| 22 | 20 |
| 23 var test = runTest(["vm_test.dart"]); | 21 var test = runTest(["vm_test.dart"]); |
| 24 test.stdout.expect(consumeThrough(contains("All tests passed!"))); | 22 test.stdout.expect(consumeThrough(contains("All tests passed!"))); |
| 25 test.shouldExit(0); | 23 test.shouldExit(0); |
| 26 }); | 24 }); |
| 27 | 25 |
| 28 test("doesn't run a test suite on a non-matching platform", () { | 26 test("doesn't run a test suite on a non-matching platform", () { |
| 29 _writeTestFile("vm_test.dart", suiteTestOn: "vm"); | 27 _writeTestFile("vm_test.dart", suiteTestOn: "vm"); |
| 30 | 28 |
| 31 var test = runTest(["--platform", "content-shell", "vm_test.dart"]); | 29 var test = runTest(["--platform", "content-shell", "vm_test.dart"]); |
| 32 test.stdout.expect(consumeThrough(contains("No tests ran."))); | 30 test.stdout.expect(consumeThrough(contains("No tests ran."))); |
| 33 test.shouldExit(0); | 31 test.shouldExit(0); |
| 34 }, tags: 'content-shell'); | 32 }, tags: 'content-shell'); |
| 35 | 33 |
| 36 test("runs a test suite on a matching operating system", () { | 34 test("runs a test suite on a matching operating system", () { |
| 37 _writeTestFile("os_test.dart", suiteTestOn: currentOS.name); | 35 _writeTestFile("os_test.dart", suiteTestOn: currentOS.identifier); |
| 38 | 36 |
| 39 var test = runTest(["os_test.dart"]); | 37 var test = runTest(["os_test.dart"]); |
| 40 test.stdout.expect(consumeThrough(contains("All tests passed!"))); | 38 test.stdout.expect(consumeThrough(contains("All tests passed!"))); |
| 41 test.shouldExit(0); | 39 test.shouldExit(0); |
| 42 }); | 40 }); |
| 43 | 41 |
| 44 test("doesn't run a test suite on a non-matching operating system", () { | 42 test("doesn't run a test suite on a non-matching operating system", () { |
| 45 _writeTestFile("os_test.dart", suiteTestOn: _otherOS, | 43 _writeTestFile("os_test.dart", suiteTestOn: otherOS, |
| 46 loadable: false); | 44 loadable: false); |
| 47 | 45 |
| 48 var test = runTest(["os_test.dart"]); | 46 var test = runTest(["os_test.dart"]); |
| 49 test.stdout.expect(consumeThrough(contains("No tests ran."))); | 47 test.stdout.expect(consumeThrough(contains("No tests ran."))); |
| 50 test.shouldExit(0); | 48 test.shouldExit(0); |
| 51 }); | 49 }); |
| 52 | 50 |
| 53 test("only loads matching files when loading as a group", () { | 51 test("only loads matching files when loading as a group", () { |
| 54 _writeTestFile("vm_test.dart", suiteTestOn: "vm"); | 52 _writeTestFile("vm_test.dart", suiteTestOn: "vm"); |
| 55 _writeTestFile("browser_test.dart", | 53 _writeTestFile("browser_test.dart", |
| 56 suiteTestOn: "browser", loadable: false); | 54 suiteTestOn: "browser", loadable: false); |
| 57 _writeTestFile("this_os_test.dart", suiteTestOn: currentOS.name); | 55 _writeTestFile("this_os_test.dart", suiteTestOn: currentOS.identifier); |
| 58 _writeTestFile("other_os_test.dart", | 56 _writeTestFile("other_os_test.dart", |
| 59 suiteTestOn: _otherOS, loadable: false); | 57 suiteTestOn: otherOS, loadable: false); |
| 60 | 58 |
| 61 var test = runTest(["."]); | 59 var test = runTest(["."]); |
| 62 test.stdout.expect(consumeThrough(contains("+2: All tests passed!"))); | 60 test.stdout.expect(consumeThrough(contains("+2: All tests passed!"))); |
| 63 test.shouldExit(0); | 61 test.shouldExit(0); |
| 64 }); | 62 }); |
| 65 }); | 63 }); |
| 66 | 64 |
| 67 group("for group", () { | 65 group("for group", () { |
| 68 test("runs a VM group on the VM", () { | 66 test("runs a VM group on the VM", () { |
| 69 _writeTestFile("vm_test.dart", groupTestOn: "vm"); | 67 _writeTestFile("vm_test.dart", groupTestOn: "vm"); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 if (groupTestOn != null) { | 196 if (groupTestOn != null) { |
| 199 buffer.writeln(" }, testOn: '$groupTestOn');"); | 197 buffer.writeln(" }, testOn: '$groupTestOn');"); |
| 200 } else { | 198 } else { |
| 201 buffer.writeln(" });"); | 199 buffer.writeln(" });"); |
| 202 } | 200 } |
| 203 | 201 |
| 204 buffer.writeln("}"); | 202 buffer.writeln("}"); |
| 205 | 203 |
| 206 d.file(filename, buffer.toString()).create(); | 204 d.file(filename, buffer.toString()).create(); |
| 207 } | 205 } |
| OLD | NEW |