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 library unittest.loader; | 5 library unittest.loader; |
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:unittest/src/loader.dart'; | 10 import 'package:unittest/src/loader.dart'; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 test("can load and run a failing test", () { | 77 test("can load and run a failing test", () { |
78 var liveTest = suite.tests[1].load(suite); | 78 var liveTest = suite.tests[1].load(suite); |
79 expectSingleFailure(liveTest); | 79 expectSingleFailure(liveTest); |
80 return liveTest.run().whenComplete(() => liveTest.close()); | 80 return liveTest.run().whenComplete(() => liveTest.close()); |
81 }); | 81 }); |
82 | 82 |
83 test("throws a nice error if the package root doesn't exist", () { | 83 test("throws a nice error if the package root doesn't exist", () { |
84 var loader = new Loader(); | 84 var loader = new Loader(); |
85 expect(() => loader.loadFile(p.join(_sandbox, 'a_test.dart')), | 85 expect(() => loader.loadFile(p.join(_sandbox, 'a_test.dart')), |
86 throwsA(isFileSystemException( | 86 throwsA(isLoadException( |
87 "Directory ${p.join(_sandbox, 'packages')} does not exist."))); | 87 "Directory ${p.join(_sandbox, 'packages')} does not exist."))); |
88 }); | 88 }); |
89 }); | 89 }); |
90 | 90 |
91 group(".loadDir()", () { | 91 group(".loadDir()", () { |
92 test("ignores non-Dart files", () { | 92 test("ignores non-Dart files", () { |
93 new File(p.join(_sandbox, 'a_test.txt')).writeAsStringSync(_tests); | 93 new File(p.join(_sandbox, 'a_test.txt')).writeAsStringSync(_tests); |
94 expect(_loader.loadDir(_sandbox), completion(isEmpty)); | 94 expect(_loader.loadDir(_sandbox), completion(isEmpty)); |
95 }); | 95 }); |
96 | 96 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 test("can run tests in those suites", () { | 132 test("can run tests in those suites", () { |
133 var suite = suites.firstWhere((suite) => suite.name.contains("a_test")); | 133 var suite = suites.firstWhere((suite) => suite.name.contains("a_test")); |
134 var liveTest = suite.tests[1].load(suite); | 134 var liveTest = suite.tests[1].load(suite); |
135 expectSingleFailure(liveTest); | 135 expectSingleFailure(liveTest); |
136 return liveTest.run().whenComplete(() => liveTest.close()); | 136 return liveTest.run().whenComplete(() => liveTest.close()); |
137 }); | 137 }); |
138 }); | 138 }); |
139 }); | 139 }); |
140 } | 140 } |
OLD | NEW |