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/state.dart'; | 9 import 'package:test/src/backend/state.dart'; |
10 import 'package:test/src/backend/suite.dart'; | 10 import 'package:test/src/backend/suite.dart'; |
| 11 import 'package:test/src/backend/test_platform.dart'; |
11 import 'package:test/src/runner/load_exception.dart'; | 12 import 'package:test/src/runner/load_exception.dart'; |
12 import 'package:test/src/runner/load_suite.dart'; | 13 import 'package:test/src/runner/load_suite.dart'; |
13 import 'package:test/test.dart'; | 14 import 'package:test/test.dart'; |
14 | 15 |
15 import '../utils.dart'; | 16 import '../utils.dart'; |
16 | 17 |
17 void main() { | 18 void main() { |
18 test("running a load test causes LoadSuite.suite to emit a suite", () async { | 19 test("running a load test causes LoadSuite.suite to emit a suite", () async { |
19 var innerSuite = new Suite([]); | 20 var innerSuite = new Suite([]); |
20 var suite = new LoadSuite("name", () => new Future.value(innerSuite)); | 21 var suite = new LoadSuite("name", () => new Future.value(innerSuite)); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 101 |
101 expect(suite.suite, completion(equals(innerSuite))); | 102 expect(suite.suite, completion(equals(innerSuite))); |
102 var liveTest = await suite.tests.single.load(suite); | 103 var liveTest = await suite.tests.single.load(suite); |
103 await liveTest.run(); | 104 await liveTest.run(); |
104 expectTestPassed(liveTest); | 105 expectTestPassed(liveTest); |
105 }); | 106 }); |
106 | 107 |
107 group("changeSuite()", () { | 108 group("changeSuite()", () { |
108 test("returns a new load suite with the same properties", () { | 109 test("returns a new load suite with the same properties", () { |
109 var innerSuite = new Suite([]); | 110 var innerSuite = new Suite([]); |
110 var suite = new LoadSuite("name", () => innerSuite, platform: "platform"); | 111 var suite = new LoadSuite("name", () => innerSuite, |
| 112 platform: TestPlatform.vm); |
111 expect(suite.tests, hasLength(1)); | 113 expect(suite.tests, hasLength(1)); |
112 | 114 |
113 var newSuite = suite.changeSuite((suite) => suite); | 115 var newSuite = suite.changeSuite((suite) => suite); |
114 expect(newSuite.platform, equals("platform")); | 116 expect(newSuite.platform, equals(TestPlatform.vm)); |
115 expect(newSuite.tests, equals(suite.tests)); | 117 expect(newSuite.tests, equals(suite.tests)); |
116 }); | 118 }); |
117 | 119 |
118 test("changes the inner suite", () async { | 120 test("changes the inner suite", () async { |
119 var innerSuite = new Suite([]); | 121 var innerSuite = new Suite([]); |
120 var suite = new LoadSuite("name", () => innerSuite); | 122 var suite = new LoadSuite("name", () => innerSuite); |
121 expect(suite.tests, hasLength(1)); | 123 expect(suite.tests, hasLength(1)); |
122 | 124 |
123 var newInnerSuite = new Suite([]); | 125 var newInnerSuite = new Suite([]); |
124 var newSuite = suite.changeSuite((suite) => newInnerSuite); | 126 var newSuite = suite.changeSuite((suite) => newInnerSuite); |
(...skipping 27 matching lines...) Expand all Loading... |
152 }); | 154 }); |
153 | 155 |
154 test("forwards errors to the future", () { | 156 test("forwards errors to the future", () { |
155 var suite = new LoadSuite("name", () => throw "error"); | 157 var suite = new LoadSuite("name", () => throw "error"); |
156 expect(suite.tests, hasLength(1)); | 158 expect(suite.tests, hasLength(1)); |
157 | 159 |
158 expect(suite.getSuite(), throwsA("error")); | 160 expect(suite.getSuite(), throwsA("error")); |
159 }); | 161 }); |
160 }); | 162 }); |
161 } | 163 } |
OLD | NEW |