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:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 """); | 168 """); |
169 }); | 169 }); |
170 | 170 |
171 test("itself", () { | 171 test("itself", () { |
172 var result = _runTest(["-p", "firefox", "test.dart"]); | 172 var result = _runTest(["-p", "firefox", "test.dart"]); |
173 expect(result.exitCode, equals(0)); | 173 expect(result.exitCode, equals(0)); |
174 }); | 174 }); |
175 | 175 |
176 test("alongside another browser", () { | 176 test("alongside another browser", () { |
177 var result = _runTest(["-p", "firefox", "-p", "chrome", "test.dart"]); | 177 var result = _runTest(["-p", "firefox", "-p", "chrome", "test.dart"]); |
178 expect("Compiling".allMatches(result.stdout), hasLength(1)); | 178 |
| 179 // Only one browser should compile the code. |
| 180 expect(result.stdout.contains("[Chrome] compiling"), |
| 181 isNot(result.stdout.contains("[Firefox] compiling"))); |
179 expect(result.exitCode, equals(0)); | 182 expect(result.exitCode, equals(0)); |
180 }); | 183 }); |
181 }); | 184 }); |
182 | 185 |
183 test("can run failing tests", () { | 186 test("can run failing tests", () { |
184 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" | 187 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" |
185 import 'package:test/test.dart'; | 188 import 'package:test/test.dart'; |
186 | 189 |
187 void main() { | 190 void main() { |
188 test("failure", () => throw new TestFailure("oh no")); | 191 test("failure", () => throw new TestFailure("oh no")); |
189 } | 192 } |
190 """); | 193 """); |
191 | 194 |
192 var result = _runTest(["-p", "firefox", "test.dart"]); | 195 var result = _runTest(["-p", "firefox", "test.dart"]); |
193 expect(result.exitCode, equals(1)); | 196 expect(result.exitCode, equals(1)); |
194 }); | 197 }); |
195 } | 198 } |
196 | 199 |
197 ProcessResult _runTest(List<String> args) => | 200 ProcessResult _runTest(List<String> args) => |
198 runTest(args, workingDirectory: _sandbox); | 201 runTest(args, workingDirectory: _sandbox); |
OLD | NEW |