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