| 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/backend/state.dart'; | 10 import 'package:test/src/backend/state.dart'; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return liveTest.run().whenComplete(() => liveTest.close()); | 81 return liveTest.run().whenComplete(() => liveTest.close()); |
| 82 }); | 82 }); |
| 83 | 83 |
| 84 test("can load and run a failing test", () { | 84 test("can load and run a failing test", () { |
| 85 var liveTest = suite.tests[1].load(suite); | 85 var liveTest = suite.tests[1].load(suite); |
| 86 expectSingleFailure(liveTest); | 86 expectSingleFailure(liveTest); |
| 87 return liveTest.run().whenComplete(() => liveTest.close()); | 87 return liveTest.run().whenComplete(() => liveTest.close()); |
| 88 }); | 88 }); |
| 89 | 89 |
| 90 test("throws a nice error if the package root doesn't exist", () { | 90 test("throws a nice error if the package root doesn't exist", () { |
| 91 var loader = new Loader([TestPlatform.vm], root: _sandbox); | 91 expect(() => new Loader([TestPlatform.chrome], root: _sandbox), |
| 92 expect( | 92 throwsA(isApplicationException( |
| 93 loader.loadFile(p.join(_sandbox, 'a_test.dart')).first | |
| 94 .whenComplete(loader.close), | |
| 95 throwsA(isLoadException( | |
| 96 "Directory ${p.join(_sandbox, 'packages')} does not exist."))); | 93 "Directory ${p.join(_sandbox, 'packages')} does not exist."))); |
| 97 }); | 94 }); |
| 98 }); | 95 }); |
| 99 | 96 |
| 100 group(".loadDir()", () { | 97 group(".loadDir()", () { |
| 101 test("ignores non-Dart files", () { | 98 test("ignores non-Dart files", () { |
| 102 new File(p.join(_sandbox, 'a_test.txt')).writeAsStringSync(_tests); | 99 new File(p.join(_sandbox, 'a_test.txt')).writeAsStringSync(_tests); |
| 103 expect(_loader.loadDir(_sandbox).toList(), completion(isEmpty)); | 100 expect(_loader.loadDir(_sandbox).toList(), completion(isEmpty)); |
| 104 }); | 101 }); |
| 105 | 102 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 138 |
| 142 test("can run tests in those suites", () { | 139 test("can run tests in those suites", () { |
| 143 var suite = suites.firstWhere((suite) => suite.path.contains("a_test")); | 140 var suite = suites.firstWhere((suite) => suite.path.contains("a_test")); |
| 144 var liveTest = suite.tests[1].load(suite); | 141 var liveTest = suite.tests[1].load(suite); |
| 145 expectSingleFailure(liveTest); | 142 expectSingleFailure(liveTest); |
| 146 return liveTest.run().whenComplete(() => liveTest.close()); | 143 return liveTest.run().whenComplete(() => liveTest.close()); |
| 147 }); | 144 }); |
| 148 }); | 145 }); |
| 149 }); | 146 }); |
| 150 } | 147 } |
| OLD | NEW |