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 library test.backend.live_test; | 5 library test.backend.live_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'group.dart'; | 9 import 'group.dart'; |
10 import 'state.dart'; | 10 import 'state.dart'; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (group.name == null) return test.name; | 108 if (group.name == null) return test.name; |
109 if (!test.name.startsWith(group.name)) return test.name; | 109 if (!test.name.startsWith(group.name)) return test.name; |
110 | 110 |
111 // The test will have the same name as the group for virtual tests created | 111 // The test will have the same name as the group for virtual tests created |
112 // to represent skipping the entire group. | 112 // to represent skipping the entire group. |
113 if (test.name.length == group.name.length) return ""; | 113 if (test.name.length == group.name.length) return ""; |
114 | 114 |
115 return test.name.substring(group.name.length + 1); | 115 return test.name.substring(group.name.length + 1); |
116 } | 116 } |
117 | 117 |
| 118 /// Loads a copy of this [LiveTest] that's able to be run again. |
| 119 LiveTest copy() => test.load(suite, groups: groups); |
| 120 |
118 /// Signals that this test should start running as soon as possible. | 121 /// Signals that this test should start running as soon as possible. |
119 /// | 122 /// |
120 /// A test may not start running immediately for various reasons specific to | 123 /// A test may not start running immediately for various reasons specific to |
121 /// the means by which it's defined. Until it starts running, [state] will | 124 /// the means by which it's defined. Until it starts running, [state] will |
122 /// continue to be marked [Status.pending]. | 125 /// continue to be marked [Status.pending]. |
123 /// | 126 /// |
124 /// This returns the same [Future] as [onComplete]. It may not be called more | 127 /// This returns the same [Future] as [onComplete]. It may not be called more |
125 /// than once. | 128 /// than once. |
126 Future run(); | 129 Future run(); |
127 | 130 |
128 /// Signals that this test should stop emitting events and release any | 131 /// Signals that this test should stop emitting events and release any |
129 /// resources it may have allocated. | 132 /// resources it may have allocated. |
130 /// | 133 /// |
131 /// Once [close] is called, [onComplete] will complete if it hasn't already | 134 /// Once [close] is called, [onComplete] will complete if it hasn't already |
132 /// and [onStateChange] and [onError] will close immediately. This means that, | 135 /// and [onStateChange] and [onError] will close immediately. This means that, |
133 /// if the test was running at the time [close] is called, it will never emit | 136 /// if the test was running at the time [close] is called, it will never emit |
134 /// a [Status.complete] state-change event. Once a test is closed, [expect] | 137 /// a [Status.complete] state-change event. Once a test is closed, [expect] |
135 /// and [expectAsync] will throw a [ClosedException] to help the test | 138 /// and [expectAsync] will throw a [ClosedException] to help the test |
136 /// terminate as quickly as possible. | 139 /// terminate as quickly as possible. |
137 /// | 140 /// |
138 /// This doesn't automatically happen after the test completes because there | 141 /// This doesn't automatically happen after the test completes because there |
139 /// may be more asynchronous work going on in the background that could | 142 /// may be more asynchronous work going on in the background that could |
140 /// produce new errors. | 143 /// produce new errors. |
141 /// | 144 /// |
142 /// Returns a [Future] that completes once all resources are released *and* | 145 /// Returns a [Future] that completes once all resources are released *and* |
143 /// the test has completed. This allows the caller to wait until the test's | 146 /// the test has completed. This allows the caller to wait until the test's |
144 /// tear-down logic has run. | 147 /// tear-down logic has run. |
145 Future close(); | 148 Future close(); |
146 } | 149 } |
OLD | NEW |