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:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
10 import 'package:test/src/util/io.dart'; | 10 import 'package:test/src/util/io.dart'; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // 15078 is fixed. | 119 // 15078 is fixed. |
120 }); | 120 }); |
121 | 121 |
122 group("runs successful tests", () { | 122 group("runs successful tests", () { |
123 test("on Chrome", () { | 123 test("on Chrome", () { |
124 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); | 124 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); |
125 var result = _runUnittest(["-p", "chrome", "test.dart"]); | 125 var result = _runUnittest(["-p", "chrome", "test.dart"]); |
126 expect(result.exitCode, equals(0)); | 126 expect(result.exitCode, equals(0)); |
127 }); | 127 }); |
128 | 128 |
| 129 test("on PhantomJS", () { |
| 130 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); |
| 131 var result = _runUnittest(["-p", "phantomjs", "test.dart"]); |
| 132 expect(result.exitCode, equals(0)); |
| 133 }); |
| 134 |
129 test("on Firefox", () { | 135 test("on Firefox", () { |
130 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); | 136 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); |
131 var result = _runUnittest(["-p", "firefox", "test.dart"]); | 137 var result = _runUnittest(["-p", "firefox", "test.dart"]); |
132 expect(result.exitCode, equals(0)); | 138 expect(result.exitCode, equals(0)); |
133 }); | 139 }); |
134 | 140 |
135 test("on Dartium", () { | 141 test("on Dartium", () { |
136 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); | 142 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); |
137 var result = _runUnittest(["-p", "dartium", "test.dart"]); | 143 var result = _runUnittest(["-p", "dartium", "test.dart"]); |
138 expect(result.stdout, isNot(contains("Compiling"))); | 144 expect(result.stdout, isNot(contains("Compiling"))); |
(...skipping 29 matching lines...) Expand all Loading... |
168 }); | 174 }); |
169 }); | 175 }); |
170 | 176 |
171 group("runs failing tests", () { | 177 group("runs failing tests", () { |
172 test("on Chrome", () { | 178 test("on Chrome", () { |
173 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); | 179 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); |
174 var result = _runUnittest(["-p", "chrome", "test.dart"]); | 180 var result = _runUnittest(["-p", "chrome", "test.dart"]); |
175 expect(result.exitCode, equals(1)); | 181 expect(result.exitCode, equals(1)); |
176 }); | 182 }); |
177 | 183 |
| 184 test("on PhantomJS", () { |
| 185 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); |
| 186 var result = _runUnittest(["-p", "phantomjs", "test.dart"]); |
| 187 expect(result.exitCode, equals(1)); |
| 188 }); |
| 189 |
178 test("on Firefox", () { | 190 test("on Firefox", () { |
179 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); | 191 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); |
180 var result = _runUnittest(["-p", "firefox", "test.dart"]); | 192 var result = _runUnittest(["-p", "firefox", "test.dart"]); |
181 expect(result.exitCode, equals(1)); | 193 expect(result.exitCode, equals(1)); |
182 }); | 194 }); |
183 | 195 |
184 test("on Dartium", () { | 196 test("on Dartium", () { |
185 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); | 197 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); |
186 var result = _runUnittest(["-p", "dartium", "test.dart"]); | 198 var result = _runUnittest(["-p", "dartium", "test.dart"]); |
187 expect(result.exitCode, equals(1)); | 199 expect(result.exitCode, equals(1)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 """); | 255 """); |
244 | 256 |
245 var result = _runUnittest(["-p", "chrome", "test.dart"]); | 257 var result = _runUnittest(["-p", "chrome", "test.dart"]); |
246 expect(result.stdout, contains("Hello,\nworld!\n")); | 258 expect(result.stdout, contains("Hello,\nworld!\n")); |
247 expect(result.exitCode, equals(0)); | 259 expect(result.exitCode, equals(0)); |
248 }); | 260 }); |
249 } | 261 } |
250 | 262 |
251 ProcessResult _runUnittest(List<String> args) => | 263 ProcessResult _runUnittest(List<String> args) => |
252 runUnittest(args, workingDirectory: _sandbox); | 264 runUnittest(args, workingDirectory: _sandbox); |
OLD | NEW |