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

Unified Diff: lib/src/prints_matcher.dart

Issue 934413002: Replace the existing unittest APIs with the new runner infrastructure. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Code review changes Created 5 years, 10 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 | « lib/src/internal_test_case.dart ('k') | lib/src/simple_configuration.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/prints_matcher.dart
diff --git a/lib/src/prints_matcher.dart b/lib/src/prints_matcher.dart
index 92efdcac5e0ae9befd318035a7c4b0e2b1880240..4a7c0179f4979e9d98e0942510e835692955760f 100644
--- a/lib/src/prints_matcher.dart
+++ b/lib/src/prints_matcher.dart
@@ -8,7 +8,8 @@ import 'dart:async';
import 'package:matcher/matcher.dart' hide completes, expect;
-import '../unittest.dart';
+import 'future_matchers.dart';
+import 'expect.dart';
/// Matches a [Function] that prints text that matches [matcher].
///
@@ -41,7 +42,16 @@ class _Prints extends Matcher {
}
return completes.matches(result.then((_) {
- expect(buffer.toString(), _matcher);
+ // Re-run expect() so we get the same formatting as we would without being
+ // asynchronous.
+ expect(() {
+ var actual = buffer.toString();
+ if (actual.isEmpty) return;
+
+ // Strip off the final newline because [print] will re-add it.
+ actual = actual.substring(0, actual.length - 1);
+ print(actual);
+ }, this);
}), matchState);
}
« no previous file with comments | « lib/src/internal_test_case.dart ('k') | lib/src/simple_configuration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698