| 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:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:test/src/backend/group.dart'; | 9 import 'package:test/src/backend/group.dart'; |
| 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/load_exception.dart'; | 12 import 'package:test/src/runner/load_exception.dart'; |
| 13 import 'package:test/src/runner/load_suite.dart'; | 13 import 'package:test/src/runner/load_suite.dart'; |
| 14 import 'package:test/src/runner/plugin/environment.dart'; |
| 14 import 'package:test/src/runner/runner_suite.dart'; | 15 import 'package:test/src/runner/runner_suite.dart'; |
| 15 import 'package:test/src/runner/vm/environment.dart'; | |
| 16 import 'package:test/test.dart'; | 16 import 'package:test/test.dart'; |
| 17 | 17 |
| 18 import '../utils.dart'; | 18 import '../utils.dart'; |
| 19 | 19 |
| 20 void main() { | 20 void main() { |
| 21 var innerSuite; | 21 var innerSuite; |
| 22 setUp(() { | 22 setUp(() { |
| 23 innerSuite = new RunnerSuite(const VMEnvironment(), new Group.root([])); | 23 innerSuite = new RunnerSuite(const PluginEnvironment(), new Group.root([])); |
| 24 }); | 24 }); |
| 25 | 25 |
| 26 test("running a load test causes LoadSuite.suite to emit a suite", () async { | 26 test("running a load test causes LoadSuite.suite to emit a suite", () async { |
| 27 var suite = new LoadSuite("name", () => new Future.value(innerSuite)); | 27 var suite = new LoadSuite("name", () => new Future.value(innerSuite)); |
| 28 expect(suite.group.entries, hasLength(1)); | 28 expect(suite.group.entries, hasLength(1)); |
| 29 | 29 |
| 30 expect(suite.suite, completion(equals(innerSuite))); | 30 expect(suite.suite, completion(equals(innerSuite))); |
| 31 var liveTest = await suite.group.entries.single.load(suite); | 31 var liveTest = await suite.group.entries.single.load(suite); |
| 32 await liveTest.run(); | 32 await liveTest.run(); |
| 33 expectTestPassed(liveTest); | 33 expectTestPassed(liveTest); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 var newSuite = suite.changeSuite((suite) => suite); | 118 var newSuite = suite.changeSuite((suite) => suite); |
| 119 expect(newSuite.platform, equals(TestPlatform.vm)); | 119 expect(newSuite.platform, equals(TestPlatform.vm)); |
| 120 expect(newSuite.group.entries.single.name, equals(suite.group.entries.sing
le.name)); | 120 expect(newSuite.group.entries.single.name, equals(suite.group.entries.sing
le.name)); |
| 121 }); | 121 }); |
| 122 | 122 |
| 123 test("changes the inner suite", () async { | 123 test("changes the inner suite", () async { |
| 124 var suite = new LoadSuite("name", () => innerSuite); | 124 var suite = new LoadSuite("name", () => innerSuite); |
| 125 expect(suite.group.entries, hasLength(1)); | 125 expect(suite.group.entries, hasLength(1)); |
| 126 | 126 |
| 127 var newInnerSuite = new RunnerSuite( | 127 var newInnerSuite = new RunnerSuite( |
| 128 const VMEnvironment(), new Group.root([])); | 128 const PluginEnvironment(), new Group.root([])); |
| 129 var newSuite = suite.changeSuite((suite) => newInnerSuite); | 129 var newSuite = suite.changeSuite((suite) => newInnerSuite); |
| 130 expect(newSuite.suite, completion(equals(newInnerSuite))); | 130 expect(newSuite.suite, completion(equals(newInnerSuite))); |
| 131 | 131 |
| 132 var liveTest = await suite.group.entries.single.load(suite); | 132 var liveTest = await suite.group.entries.single.load(suite); |
| 133 await liveTest.run(); | 133 await liveTest.run(); |
| 134 expectTestPassed(liveTest); | 134 expectTestPassed(liveTest); |
| 135 }); | 135 }); |
| 136 | 136 |
| 137 test("doesn't run change() if the suite is null", () async { | 137 test("doesn't run change() if the suite is null", () async { |
| 138 var suite = new LoadSuite("name", () => null); | 138 var suite = new LoadSuite("name", () => null); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 156 }); | 156 }); |
| 157 | 157 |
| 158 test("forwards errors to the future", () { | 158 test("forwards errors to the future", () { |
| 159 var suite = new LoadSuite("name", () => throw "error"); | 159 var suite = new LoadSuite("name", () => throw "error"); |
| 160 expect(suite.group.entries, hasLength(1)); | 160 expect(suite.group.entries, hasLength(1)); |
| 161 | 161 |
| 162 expect(suite.getSuite(), throwsA("error")); | 162 expect(suite.getSuite(), throwsA("error")); |
| 163 }); | 163 }); |
| 164 }); | 164 }); |
| 165 } | 165 } |
| OLD | NEW |