OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library testing.chain; | 5 library testing.chain; |
6 | 6 |
7 import 'dart:async' show Future, Stream; | 7 import 'dart:async' show Future, Stream; |
8 | 8 |
9 import 'dart:convert' show JSON, JsonEncoder; | 9 import 'dart:convert' show JSON, JsonEncoder; |
10 | 10 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 future = runGuarded(() async { | 174 future = runGuarded(() async { |
175 try { | 175 try { |
176 return await step.run(input, this); | 176 return await step.run(input, this); |
177 } catch (error, trace) { | 177 } catch (error, trace) { |
178 return step.unhandledError(error, trace); | 178 return step.unhandledError(error, trace); |
179 } | 179 } |
180 }, printLineOnStdout: sb.writeln); | 180 }, printLineOnStdout: sb.writeln); |
181 } else { | 181 } else { |
182 future = new Future.value(null); | 182 future = new Future.value(null); |
183 } | 183 } |
184 future = future.then((Result currentResult) { | 184 future = future.then((_currentResult) { |
| 185 Result currentResult = _currentResult; |
185 if (currentResult != null) { | 186 if (currentResult != null) { |
186 logStepComplete(completed, unexpectedResults.length, | 187 logStepComplete(completed, unexpectedResults.length, |
187 descriptions.length, suite, description, lastStepRun); | 188 descriptions.length, suite, description, lastStepRun); |
188 result = currentResult; | 189 result = currentResult; |
189 if (currentResult.outcome == Expectation.Pass) { | 190 if (currentResult.outcome == Expectation.Pass) { |
190 // The input to the next step is the output of this step. | 191 // The input to the next step is the output of this step. |
191 return doStep(result.output); | 192 return doStep(result.output); |
192 } | 193 } |
193 } | 194 } |
194 if (description.multitestExpectations != null) { | 195 if (description.multitestExpectations != null) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 /// This is called from generated code. | 343 /// This is called from generated code. |
343 Future<Null> runChain(CreateContext f, Map<String, String> environment, | 344 Future<Null> runChain(CreateContext f, Map<String, String> environment, |
344 Set<String> selectors, String json) { | 345 Set<String> selectors, String json) { |
345 return withErrorHandling(() async { | 346 return withErrorHandling(() async { |
346 Chain suite = new Suite.fromJsonMap(Uri.base, JSON.decode(json)); | 347 Chain suite = new Suite.fromJsonMap(Uri.base, JSON.decode(json)); |
347 print("Running ${suite.name}"); | 348 print("Running ${suite.name}"); |
348 ChainContext context = await f(suite, environment); | 349 ChainContext context = await f(suite, environment); |
349 return context.run(suite, selectors); | 350 return context.run(suite, selectors); |
350 }); | 351 }); |
351 } | 352 } |
OLD | NEW |