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

Unified Diff: pkg/barback/test/utils.dart

Issue 108853003: Pass logs through transformer groups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix test suite name. Created 7 years 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 | « pkg/barback/test/transformer/log.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/test/utils.dart
diff --git a/pkg/barback/test/utils.dart b/pkg/barback/test/utils.dart
index 167a53475373a7c8d78e4a0df94bd0e31827877b..2f587531a14b1742dce9720234b94915738ca012 100644
--- a/pkg/barback/test/utils.dart
+++ b/pkg/barback/test/utils.dart
@@ -35,6 +35,11 @@ Barback _barback;
/// calls have already been made so later calls know which result to look for.
int _nextBuildResult;
+/// Calls to [buildShouldLog] set expectations on successive log entries from
+/// [_barback]. This keeps track of how many calls have already been made so
+/// later calls know which result to look for.
+int _nextLog;
+
void initConfig() {
if (_configured) return;
_configured = true;
@@ -88,6 +93,7 @@ void initGraph([assets,
_provider = new MockProvider(assetMap);
_barback = new Barback(_provider);
_nextBuildResult = 0;
+ _nextLog = 0;
transformers.forEach(_barback.updateTransformers);
@@ -216,12 +222,27 @@ void buildShouldFail(List matchers) {
}), completes);
}
+/// Expects that the nexted logged [LogEntry] matches [matcher] which may be
+/// either a [Matcher] or a string to match a literal string.
+void buildShouldLog(LogLevel level, matcher) {
+ expect(_getNextLog("build should log").then((log) {
+ expect(log.level, equals(level));
+ expect(log.message, matcher);
+ }), completes);
+}
+
Future<BuildResult> _getNextBuildResult(String description) {
var result = currentSchedule.wrapFuture(
_barback.results.elementAt(_nextBuildResult++));
return schedule(() => result, description);
}
+Future<LogEntry> _getNextLog(String description) {
+ var result = currentSchedule.wrapFuture(
+ _barback.log.elementAt(_nextLog++));
+ return schedule(() => result, description);
+}
+
/// Schedules an expectation that the graph will deliver an asset matching
/// [name] and [contents].
///
« no previous file with comments | « pkg/barback/test/transformer/log.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698