| 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") |
| 6 |
| 5 import 'dart:io'; | 7 import 'dart:io'; |
| 6 | 8 |
| 7 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
| 8 import 'package:unittest/src/backend/state.dart'; | 10 import 'package:unittest/src/backend/state.dart'; |
| 9 import 'package:unittest/src/backend/test_platform.dart'; | 11 import 'package:unittest/src/backend/test_platform.dart'; |
| 10 import 'package:unittest/src/runner/loader.dart'; | 12 import 'package:unittest/src/runner/loader.dart'; |
| 11 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
| 12 | 14 |
| 13 import '../io.dart'; | 15 import '../io.dart'; |
| 14 import '../utils.dart'; | 16 import '../utils.dart'; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 }); | 79 }); |
| 78 | 80 |
| 79 test("can load and run a failing test", () { | 81 test("can load and run a failing test", () { |
| 80 var liveTest = suite.tests[1].load(suite); | 82 var liveTest = suite.tests[1].load(suite); |
| 81 expectSingleFailure(liveTest); | 83 expectSingleFailure(liveTest); |
| 82 return liveTest.run().whenComplete(() => liveTest.close()); | 84 return liveTest.run().whenComplete(() => liveTest.close()); |
| 83 }); | 85 }); |
| 84 | 86 |
| 85 test("throws a nice error if the package root doesn't exist", () { | 87 test("throws a nice error if the package root doesn't exist", () { |
| 86 var loader = new Loader([TestPlatform.vm]); | 88 var loader = new Loader([TestPlatform.vm]); |
| 87 expect(() { | 89 expect( |
| 88 try { | 90 loader.loadFile(p.join(_sandbox, 'a_test.dart')) |
| 89 loader.loadFile(p.join(_sandbox, 'a_test.dart')); | 91 .whenComplete(loader.close), |
| 90 } finally { | 92 throwsA(isLoadException( |
| 91 loader.close(); | 93 "Directory ${p.join(_sandbox, 'packages')} does not exist."))); |
| 92 } | |
| 93 }, throwsA(isLoadException( | |
| 94 "Directory ${p.join(_sandbox, 'packages')} does not exist."))); | |
| 95 }); | 94 }); |
| 96 }); | 95 }); |
| 97 | 96 |
| 98 group(".loadDir()", () { | 97 group(".loadDir()", () { |
| 99 test("ignores non-Dart files", () { | 98 test("ignores non-Dart files", () { |
| 100 new File(p.join(_sandbox, 'a_test.txt')).writeAsStringSync(_tests); | 99 new File(p.join(_sandbox, 'a_test.txt')).writeAsStringSync(_tests); |
| 101 expect(_loader.loadDir(_sandbox), completion(isEmpty)); | 100 expect(_loader.loadDir(_sandbox), completion(isEmpty)); |
| 102 }); | 101 }); |
| 103 | 102 |
| 104 test("ignores files in packages/ directories", () { | 103 test("ignores files in packages/ directories", () { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 137 |
| 139 test("can run tests in those suites", () { | 138 test("can run tests in those suites", () { |
| 140 var suite = suites.firstWhere((suite) => suite.path.contains("a_test")); | 139 var suite = suites.firstWhere((suite) => suite.path.contains("a_test")); |
| 141 var liveTest = suite.tests[1].load(suite); | 140 var liveTest = suite.tests[1].load(suite); |
| 142 expectSingleFailure(liveTest); | 141 expectSingleFailure(liveTest); |
| 143 return liveTest.run().whenComplete(() => liveTest.close()); | 142 return liveTest.run().whenComplete(() => liveTest.close()); |
| 144 }); | 143 }); |
| 145 }); | 144 }); |
| 146 }); | 145 }); |
| 147 } | 146 } |
| OLD | NEW |