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: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'; |
(...skipping 15 matching lines...) Expand all Loading... |
26 test.stdout.expect(consumeThrough(contains("All tests passed!"))); | 26 test.stdout.expect(consumeThrough(contains("All tests passed!"))); |
27 test.shouldExit(0); | 27 test.shouldExit(0); |
28 }); | 28 }); |
29 | 29 |
30 test("doesn't run a test suite on a non-matching platform", () { | 30 test("doesn't run a test suite on a non-matching platform", () { |
31 _writeTestFile("vm_test.dart", suiteTestOn: "vm"); | 31 _writeTestFile("vm_test.dart", suiteTestOn: "vm"); |
32 | 32 |
33 var test = runTest(["--platform", "content-shell", "vm_test.dart"]); | 33 var test = runTest(["--platform", "content-shell", "vm_test.dart"]); |
34 test.stdout.expect(consumeThrough(contains("No tests ran."))); | 34 test.stdout.expect(consumeThrough(contains("No tests ran."))); |
35 test.shouldExit(0); | 35 test.shouldExit(0); |
36 }); | 36 }, tags: 'content-shell'); |
37 | 37 |
38 test("runs a test suite on a matching operating system", () { | 38 test("runs a test suite on a matching operating system", () { |
39 _writeTestFile("os_test.dart", suiteTestOn: currentOS.name); | 39 _writeTestFile("os_test.dart", suiteTestOn: currentOS.name); |
40 | 40 |
41 var test = runTest(["os_test.dart"]); | 41 var test = runTest(["os_test.dart"]); |
42 test.stdout.expect(consumeThrough(contains("All tests passed!"))); | 42 test.stdout.expect(consumeThrough(contains("All tests passed!"))); |
43 test.shouldExit(0); | 43 test.shouldExit(0); |
44 }); | 44 }); |
45 | 45 |
46 test("doesn't run a test suite on a non-matching operating system", () { | 46 test("doesn't run a test suite on a non-matching operating system", () { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 test.shouldExit(0); | 83 test.shouldExit(0); |
84 }); | 84 }); |
85 | 85 |
86 test("runs a browser group on a browser", () { | 86 test("runs a browser group on a browser", () { |
87 _writeTestFile("browser_test.dart", groupTestOn: "browser"); | 87 _writeTestFile("browser_test.dart", groupTestOn: "browser"); |
88 | 88 |
89 var test = runTest( | 89 var test = runTest( |
90 ["--platform", "content-shell", "browser_test.dart"]); | 90 ["--platform", "content-shell", "browser_test.dart"]); |
91 test.stdout.expect(consumeThrough(contains("All tests passed!"))); | 91 test.stdout.expect(consumeThrough(contains("All tests passed!"))); |
92 test.shouldExit(0); | 92 test.shouldExit(0); |
93 }); | 93 }, tags: 'content-shell'); |
94 | 94 |
95 test("doesn't run a VM group on a browser", () { | 95 test("doesn't run a VM group on a browser", () { |
96 _writeTestFile("vm_test.dart", groupTestOn: "vm"); | 96 _writeTestFile("vm_test.dart", groupTestOn: "vm"); |
97 | 97 |
98 var test = runTest(["--platform", "content-shell", "vm_test.dart"]); | 98 var test = runTest(["--platform", "content-shell", "vm_test.dart"]); |
99 test.stdout.expect(consumeThrough(contains("No tests ran."))); | 99 test.stdout.expect(consumeThrough(contains("No tests ran."))); |
100 test.shouldExit(0); | 100 test.shouldExit(0); |
101 }); | 101 }, tags: 'content-shell'); |
102 }); | 102 }); |
103 | 103 |
104 group("for test", () { | 104 group("for test", () { |
105 test("runs a VM test on the VM", () { | 105 test("runs a VM test on the VM", () { |
106 _writeTestFile("vm_test.dart", testTestOn: "vm"); | 106 _writeTestFile("vm_test.dart", testTestOn: "vm"); |
107 | 107 |
108 var test = runTest(["vm_test.dart"]); | 108 var test = runTest(["vm_test.dart"]); |
109 test.stdout.expect(consumeThrough(contains("All tests passed!"))); | 109 test.stdout.expect(consumeThrough(contains("All tests passed!"))); |
110 test.shouldExit(0); | 110 test.shouldExit(0); |
111 }); | 111 }); |
112 | 112 |
113 test("doesn't run a browser test on the VM", () { | 113 test("doesn't run a browser test on the VM", () { |
114 _writeTestFile("browser_test.dart", testTestOn: "browser"); | 114 _writeTestFile("browser_test.dart", testTestOn: "browser"); |
115 | 115 |
116 var test = runTest(["browser_test.dart"]); | 116 var test = runTest(["browser_test.dart"]); |
117 test.stdout.expect(consumeThrough(contains("No tests ran."))); | 117 test.stdout.expect(consumeThrough(contains("No tests ran."))); |
118 test.shouldExit(0); | 118 test.shouldExit(0); |
119 }); | 119 }); |
120 | 120 |
121 test("runs a browser test on a browser", () { | 121 test("runs a browser test on a browser", () { |
122 _writeTestFile("browser_test.dart", testTestOn: "browser"); | 122 _writeTestFile("browser_test.dart", testTestOn: "browser"); |
123 | 123 |
124 var test = runTest( | 124 var test = runTest( |
125 ["--platform", "content-shell", "browser_test.dart"]); | 125 ["--platform", "content-shell", "browser_test.dart"]); |
126 test.stdout.expect(consumeThrough(contains("All tests passed!"))); | 126 test.stdout.expect(consumeThrough(contains("All tests passed!"))); |
127 test.shouldExit(0); | 127 test.shouldExit(0); |
128 }); | 128 }, tags: 'content-shell'); |
129 | 129 |
130 test("doesn't run a VM test on a browser", () { | 130 test("doesn't run a VM test on a browser", () { |
131 _writeTestFile("vm_test.dart", testTestOn: "vm"); | 131 _writeTestFile("vm_test.dart", testTestOn: "vm"); |
132 | 132 |
133 var test = runTest(["--platform", "content-shell", "vm_test.dart"]); | 133 var test = runTest(["--platform", "content-shell", "vm_test.dart"]); |
134 test.stdout.expect(consumeThrough(contains("No tests ran."))); | 134 test.stdout.expect(consumeThrough(contains("No tests ran."))); |
135 test.shouldExit(0); | 135 test.shouldExit(0); |
136 }); | 136 }, tags: 'content-shell'); |
137 }); | 137 }); |
138 | 138 |
139 group("with suite, group, and test selectors", () { | 139 group("with suite, group, and test selectors", () { |
140 test("runs the test if all selectors match", () { | 140 test("runs the test if all selectors match", () { |
141 _writeTestFile("vm_test.dart", suiteTestOn: "!browser", | 141 _writeTestFile("vm_test.dart", suiteTestOn: "!browser", |
142 groupTestOn: "!js", testTestOn: "vm"); | 142 groupTestOn: "!js", testTestOn: "vm"); |
143 | 143 |
144 var test = runTest(["vm_test.dart"]); | 144 var test = runTest(["vm_test.dart"]); |
145 test.stdout.expect(consumeThrough(contains("All tests passed!"))); | 145 test.stdout.expect(consumeThrough(contains("All tests passed!"))); |
146 test.shouldExit(0); | 146 test.shouldExit(0); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 if (groupTestOn != null) { | 200 if (groupTestOn != null) { |
201 buffer.writeln(" }, testOn: '$groupTestOn');"); | 201 buffer.writeln(" }, testOn: '$groupTestOn');"); |
202 } else { | 202 } else { |
203 buffer.writeln(" });"); | 203 buffer.writeln(" });"); |
204 } | 204 } |
205 | 205 |
206 buffer.writeln("}"); | 206 buffer.writeln("}"); |
207 | 207 |
208 d.file(filename, buffer.toString()).create(); | 208 d.file(filename, buffer.toString()).create(); |
209 } | 209 } |
OLD | NEW |