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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 expect("Compiling".allMatches(result.stdout), hasLength(1)); | 291 expect("Compiling".allMatches(result.stdout), hasLength(1)); |
292 expect(result.exitCode, equals(0)); | 292 expect(result.exitCode, equals(0)); |
293 }); | 293 }); |
294 | 294 |
295 test("on the browser and the VM", () { | 295 test("on the browser and the VM", () { |
296 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); | 296 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); |
297 var result = _runUnittest(["-p", "chrome", "-p", "vm", "test.dart"]); | 297 var result = _runUnittest(["-p", "chrome", "-p", "vm", "test.dart"]); |
298 expect(result.exitCode, equals(0)); | 298 expect(result.exitCode, equals(0)); |
299 }); | 299 }); |
300 | 300 |
| 301 // Regression test; this broke in 0.12.0-beta.9. |
| 302 test("on a file in a subdirectory", () { |
| 303 new Directory(p.join(_sandbox, "dir")).createSync(); |
| 304 new File(p.join(_sandbox, "dir", "test.dart")) |
| 305 .writeAsStringSync(_success); |
| 306 var result = _runUnittest(["-p", "chrome", "dir/test.dart"]); |
| 307 expect(result.exitCode, equals(0)); |
| 308 }); |
| 309 |
301 group("with a custom HTML file", () { | 310 group("with a custom HTML file", () { |
302 setUp(() { | 311 setUp(() { |
303 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" | 312 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" |
304 import 'dart:html'; | 313 import 'dart:html'; |
305 | 314 |
306 import 'package:test/test.dart'; | 315 import 'package:test/test.dart'; |
307 | 316 |
308 void main() { | 317 void main() { |
309 test("success", () { | 318 test("success", () { |
310 expect(document.query('#foo'), isNotNull); | 319 expect(document.query('#foo'), isNotNull); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 '''); | 490 '''); |
482 | 491 |
483 var result = _runUnittest(["-p", "chrome", "test.dart"]); | 492 var result = _runUnittest(["-p", "chrome", "test.dart"]); |
484 expect(result.stdout, contains("Test timed out after 0 seconds.")); | 493 expect(result.stdout, contains("Test timed out after 0 seconds.")); |
485 expect(result.stdout, contains("-1: Some tests failed.")); | 494 expect(result.stdout, contains("-1: Some tests failed.")); |
486 }); | 495 }); |
487 } | 496 } |
488 | 497 |
489 ProcessResult _runUnittest(List<String> args) => | 498 ProcessResult _runUnittest(List<String> args) => |
490 runUnittest(args, workingDirectory: _sandbox); | 499 runUnittest(args, workingDirectory: _sandbox); |
OLD | NEW |