Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions lib/src/frontend/expect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ import '../backend/invoker.dart';
import '../utils.dart';
import 'async_matcher.dart';

/// A future that emits `null`.
///
/// We cache and re-use this value to avoid adding a new microtask hit for each
/// call to `expect()`.
final _emptyFuture = new Future.value();

/// An exception thrown when a test assertion fails.
class TestFailure {
final String message;
Expand Down Expand Up @@ -120,7 +114,7 @@ Future _expect(actual, matcher,
}

Invoker.current.skip(message);
return _emptyFuture;
return new Future.sync(() {});
}

if (matcher is AsyncMatcher) {
Expand Down Expand Up @@ -151,12 +145,12 @@ Future _expect(actual, matcher,
});
}

return _emptyFuture;
return new Future.sync(() {});
}

var matchState = {};
try {
if (matcher.matches(actual, matchState)) return _emptyFuture;
if (matcher.matches(actual, matchState)) return new Future.sync(() {});
} catch (e, trace) {
reason ??= '$e at $trace';
}
Expand Down