| 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'; |
| 11 import 'package:test/src/backend/test_platform.dart'; | 11 import 'package:test/src/backend/test_platform.dart'; |
| 12 import 'package:test/src/runner/loader.dart'; | 12 import 'package:test/src/runner/loader.dart'; |
| 13 import 'package:test/src/util/io.dart'; |
| 13 import 'package:test/test.dart'; | 14 import 'package:test/test.dart'; |
| 14 | 15 |
| 15 import '../io.dart'; | 16 import '../io.dart'; |
| 16 import '../utils.dart'; | 17 import '../utils.dart'; |
| 17 | 18 |
| 18 Loader _loader; | 19 Loader _loader; |
| 19 String _sandbox; | 20 String _sandbox; |
| 20 | 21 |
| 21 final _tests = """ | 22 final _tests = """ |
| 22 import 'dart:async'; | 23 import 'dart:async'; |
| 23 | 24 |
| 24 import 'package:test/test.dart'; | 25 import 'package:test/test.dart'; |
| 25 | 26 |
| 26 void main() { | 27 void main() { |
| 27 test("success", () {}); | 28 test("success", () {}); |
| 28 test("failure", () => throw new TestFailure('oh no')); | 29 test("failure", () => throw new TestFailure('oh no')); |
| 29 test("error", () => throw 'oh no'); | 30 test("error", () => throw 'oh no'); |
| 30 } | 31 } |
| 31 """; | 32 """; |
| 32 | 33 |
| 33 void main() { | 34 void main() { |
| 34 setUp(() { | 35 setUp(() { |
| 35 _loader = new Loader([TestPlatform.vm], | 36 _loader = new Loader([TestPlatform.vm], |
| 36 packageRoot: p.join(packageDir, 'packages')); | 37 packageRoot: p.join(packageDir, 'packages')); |
| 37 _sandbox = Directory.systemTemp.createTempSync('test_').path; | 38 _sandbox = createTempDir(); |
| 38 }); | 39 }); |
| 39 | 40 |
| 40 tearDown(() { | 41 tearDown(() { |
| 41 new Directory(_sandbox).deleteSync(recursive: true); | 42 new Directory(_sandbox).deleteSync(recursive: true); |
| 42 return _loader.close(); | 43 return _loader.close(); |
| 43 }); | 44 }); |
| 44 | 45 |
| 45 group(".loadFile()", () { | 46 group(".loadFile()", () { |
| 46 var suite; | 47 var suite; |
| 47 setUp(() { | 48 setUp(() { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 138 |
| 138 test("can run tests in those suites", () { | 139 test("can run tests in those suites", () { |
| 139 var suite = suites.firstWhere((suite) => suite.path.contains("a_test")); | 140 var suite = suites.firstWhere((suite) => suite.path.contains("a_test")); |
| 140 var liveTest = suite.tests[1].load(suite); | 141 var liveTest = suite.tests[1].load(suite); |
| 141 expectSingleFailure(liveTest); | 142 expectSingleFailure(liveTest); |
| 142 return liveTest.run().whenComplete(() => liveTest.close()); | 143 return liveTest.run().whenComplete(() => liveTest.close()); |
| 143 }); | 144 }); |
| 144 }); | 145 }); |
| 145 }); | 146 }); |
| 146 } | 147 } |
| OLD | NEW |