Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Unified Diff: pkg/testing/lib/src/chain.dart

Issue 2626003003: Implement multitest expectations. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/testing/lib/src/log.dart » ('j') | pkg/testing/lib/src/multitest.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/testing/lib/src/chain.dart
diff --git a/pkg/testing/lib/src/chain.dart b/pkg/testing/lib/src/chain.dart
index 8925b9dc9f482ba0d3418602bb26c4b8713ba89b..4d7063cc2079805f9aa670db1b4c9d05db0f0ceb 100644
--- a/pkg/testing/lib/src/chain.dart
+++ b/pkg/testing/lib/src/chain.dart
@@ -45,7 +45,8 @@ import 'log.dart' show
splitLines;
import 'multitest.dart' show
- MultitestTransformer;
+ MultitestTransformer,
+ isError;
typedef Future<ChainContext> CreateContext(
Chain suite, Map<String, String> environment);
@@ -140,13 +141,15 @@ abstract class ChainContext {
!selectors.contains(suite.name)) {
continue;
}
- Set<Expectation> expectedOutcomes =
+ final Set<Expectation> expectedOutcomes =
expectations.expectations(description.shortName);
+ final StringBuffer sb = new StringBuffer();
+ final Step lastStep = steps.isNotEmpty ? steps.last : null;
+ final Iterator<Step> iterator = steps.iterator;
+
Result result;
- StringBuffer sb = new StringBuffer();
// Records the outcome of the last step that was run.
- Step lastStep = null;
- Iterator<Step> iterator = steps.iterator;
+ Step lastStepRun;
/// Performs one step of [iterator].
///
@@ -167,7 +170,7 @@ abstract class ChainContext {
bool isAsync = false;
if (iterator.moveNext()) {
Step step = iterator.current;
- lastStep = step;
+ lastStepRun = step;
isAsync = step.isAsync;
logStepStart(completed, unexpectedResults.length, descriptions.length,
suite, description, step);
@@ -184,14 +187,18 @@ abstract class ChainContext {
future = future.then((Result currentResult) {
if (currentResult != null) {
logStepComplete(completed, unexpectedResults.length,
- descriptions.length, suite, description, lastStep);
+ descriptions.length, suite, description, lastStepRun);
result = currentResult;
if (currentResult.outcome == Expectation.PASS) {
// The input to the next step is the output of this step.
return doStep(result.output);
}
}
- if (steps.isNotEmpty && steps.last == lastStep &&
+ if (description.multitestExpectations != null) {
+ if (isError(description.multitestExpectations)) {
+ result = result.toNegativeTestResult();
+ }
+ } else if (lastStep == lastStepRun &&
description.shortName.endsWith("negative_test")) {
if (result.outcome == Expectation.PASS) {
result.addLog("Negative test didn't report an error.\n");
@@ -262,6 +269,10 @@ abstract class Step<I, O, C extends ChainContext> {
bool get isAsync => false;
+ bool get isCompiler => false;
+
+ bool get isRuntime => false;
+
Future<Result<O>> run(I input, C context);
Result<O> unhandledError(error, StackTrace trace) {
« no previous file with comments | « no previous file | pkg/testing/lib/src/log.dart » ('j') | pkg/testing/lib/src/multitest.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698