OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
3 for details. All rights reserved. Use of this source code is governed by a | 3 for details. All rights reserved. Use of this source code is governed by a |
4 BSD-style license that can be found in the LICENSE file. | 4 BSD-style license that can be found in the LICENSE file. |
5 --> | 5 --> |
6 # Test Infrastructure without Batteries | 6 # Test Infrastructure without Batteries |
7 | 7 |
8 This package: | 8 This package: |
9 | 9 |
10 * Provides a way to test a compiler in multiple steps. | 10 * Provides a way to test a compiler in multiple steps. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 A suite is expected to implement a subclass of `ChainContext` which defines the
steps that make up the chain and return it from `createContext`. | 116 A suite is expected to implement a subclass of `ChainContext` which defines the
steps that make up the chain and return it from `createContext`. |
117 | 117 |
118 A step is a subclass of `Step`. The input to the first step is a `TestDescriptio
n`. The input to step n+1 is the output of step n. | 118 A step is a subclass of `Step`. The input to the first step is a `TestDescriptio
n`. The input to step n+1 is the output of step n. |
119 | 119 |
120 Here is an example of a suite that runs tests on the Dart VM: | 120 Here is an example of a suite that runs tests on the Dart VM: |
121 | 121 |
122 ```dart | 122 ```dart |
123 import 'testing.dart'; | 123 import 'testing.dart'; |
124 | 124 |
125 Future<ChainContext> createContext( | 125 Future<ChainContext> createContext( |
126 Chain suite, Map<String, String> enviroment) async { | 126 Chain suite, Map<String, String> environment) async { |
127 return new VmContext(); | 127 return new VmContext(); |
128 } | 128 } |
129 | 129 |
130 class VmContext extends ChainContext { | 130 class VmContext extends ChainContext { |
131 final List<Step> steps = const <Step>[const DartVmStep()]; | 131 final List<Step> steps = const <Step>[const DartVmStep()]; |
132 } | 132 } |
133 | 133 |
134 class DartVmStep extends Step<TestDescription, int, VmContext> { | 134 class DartVmStep extends Step<TestDescription, int, VmContext> { |
135 const DartVmStep(); | 135 const DartVmStep(); |
136 | 136 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 To run the suite `my_suite` from `package:test`, create a file named `mysuite_te
st.dart` with this content: | 256 To run the suite `my_suite` from `package:test`, create a file named `mysuite_te
st.dart` with this content: |
257 | 257 |
258 import 'package:test/test.dart' show Timeout, test; | 258 import 'package:test/test.dart' show Timeout, test; |
259 | 259 |
260 import 'package:testing/testing.dart' show run; | 260 import 'package:testing/testing.dart' show run; |
261 | 261 |
262 main() { | 262 main() { |
263 test("my_suite", () => run([], ["my_suite"]), | 263 test("my_suite", () => run([], ["my_suite"]), |
264 timeout: new Timeout(new Duration(minutes: 5))); | 264 timeout: new Timeout(new Duration(minutes: 5))); |
265 } | 265 } |
OLD | NEW |