| 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:unittest/src/backend/state.dart'; | 10 import 'package:test/src/backend/state.dart'; |
| 11 import 'package:unittest/src/backend/test_platform.dart'; | 11 import 'package:test/src/backend/test_platform.dart'; |
| 12 import 'package:unittest/src/runner/loader.dart'; | 12 import 'package:test/src/runner/loader.dart'; |
| 13 import 'package:unittest/unittest.dart'; | 13 import 'package:test/test.dart'; |
| 14 | 14 |
| 15 import '../../io.dart'; | 15 import '../../io.dart'; |
| 16 import '../../utils.dart'; | 16 import '../../utils.dart'; |
| 17 | 17 |
| 18 Loader _loader; | 18 Loader _loader; |
| 19 String _sandbox; | 19 String _sandbox; |
| 20 | 20 |
| 21 final _tests = """ | 21 final _tests = """ |
| 22 import 'dart:async'; | 22 import 'dart:async'; |
| 23 | 23 |
| 24 import 'package:unittest/unittest.dart'; | 24 import 'package:test/test.dart'; |
| 25 | 25 |
| 26 void main() { | 26 void main() { |
| 27 test("success", () {}); | 27 test("success", () {}); |
| 28 test("failure", () => throw new TestFailure('oh no')); | 28 test("failure", () => throw new TestFailure('oh no')); |
| 29 test("error", () => throw 'oh no'); | 29 test("error", () => throw 'oh no'); |
| 30 } | 30 } |
| 31 """; | 31 """; |
| 32 | 32 |
| 33 void main() { | 33 void main() { |
| 34 setUp(() { | 34 setUp(() { |
| 35 _loader = new Loader([TestPlatform.chrome], | 35 _loader = new Loader([TestPlatform.chrome], |
| 36 packageRoot: p.join(packageDir, 'packages')); | 36 packageRoot: p.join(packageDir, 'packages')); |
| 37 _sandbox = Directory.systemTemp.createTempSync('unittest_').path; | 37 _sandbox = Directory.systemTemp.createTempSync('test_').path; |
| 38 /// TODO(nweiz): Use scheduled_test for this once it's compatible with this | 38 /// TODO(nweiz): Use scheduled_test for this once it's compatible with this |
| 39 /// version of unittest. | 39 /// version of test. |
| 40 new File(p.join(_sandbox, 'a_test.dart')).writeAsStringSync(_tests); | 40 new File(p.join(_sandbox, 'a_test.dart')).writeAsStringSync(_tests); |
| 41 }); | 41 }); |
| 42 | 42 |
| 43 tearDown(() { | 43 tearDown(() { |
| 44 new Directory(_sandbox).deleteSync(recursive: true); | 44 new Directory(_sandbox).deleteSync(recursive: true); |
| 45 return _loader.close(); | 45 return _loader.close(); |
| 46 }); | 46 }); |
| 47 | 47 |
| 48 group(".loadFile()", () { | 48 group(".loadFile()", () { |
| 49 var suite; | 49 var suite; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 for (var suite in suites) { | 107 for (var suite in suites) { |
| 108 expect(suite.tests, hasLength(3)); | 108 expect(suite.tests, hasLength(3)); |
| 109 expect(suite.tests[0].name, equals("success")); | 109 expect(suite.tests[0].name, equals("success")); |
| 110 expect(suite.tests[1].name, equals("failure")); | 110 expect(suite.tests[1].name, equals("failure")); |
| 111 expect(suite.tests[2].name, equals("error")); | 111 expect(suite.tests[2].name, equals("error")); |
| 112 } | 112 } |
| 113 }).whenComplete(loader.close); | 113 }).whenComplete(loader.close); |
| 114 }); | 114 }); |
| 115 } | 115 } |
| OLD | NEW |