| 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.chrome], | 36 _loader = new Loader([TestPlatform.chrome], |
| 36 packageRoot: p.join(packageDir, 'packages')); | 37 packageRoot: p.join(packageDir, 'packages')); |
| 37 _sandbox = Directory.systemTemp.createTempSync('test_').path; | 38 _sandbox = createTempDir(); |
| 38 /// TODO(nweiz): Use scheduled_test for this once it's compatible with this | 39 /// TODO(nweiz): Use scheduled_test for this once it's compatible with this |
| 39 /// version of test. | 40 /// version of test. |
| 40 new File(p.join(_sandbox, 'a_test.dart')).writeAsStringSync(_tests); | 41 new File(p.join(_sandbox, 'a_test.dart')).writeAsStringSync(_tests); |
| 41 }); | 42 }); |
| 42 | 43 |
| 43 tearDown(() { | 44 tearDown(() { |
| 44 new Directory(_sandbox).deleteSync(recursive: true); | 45 new Directory(_sandbox).deleteSync(recursive: true); |
| 45 return _loader.close(); | 46 return _loader.close(); |
| 46 }); | 47 }); |
| 47 | 48 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 107 |
| 107 for (var suite in suites) { | 108 for (var suite in suites) { |
| 108 expect(suite.tests, hasLength(3)); | 109 expect(suite.tests, hasLength(3)); |
| 109 expect(suite.tests[0].name, equals("success")); | 110 expect(suite.tests[0].name, equals("success")); |
| 110 expect(suite.tests[1].name, equals("failure")); | 111 expect(suite.tests[1].name, equals("failure")); |
| 111 expect(suite.tests[2].name, equals("error")); | 112 expect(suite.tests[2].name, equals("error")); |
| 112 } | 113 } |
| 113 }).whenComplete(loader.close); | 114 }).whenComplete(loader.close); |
| 114 }); | 115 }); |
| 115 } | 116 } |
| OLD | NEW |