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

Unified Diff: pkg/barback/test/package_graph/lazy_transformer_test.dart

Issue 196273003: Move isPrimary computation from PhaseInput into TransformNode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 9 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 | « pkg/barback/test/package_graph/errors_test.dart ('k') | pkg/barback/test/transformer/lazy_rewrite.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/test/package_graph/lazy_transformer_test.dart
diff --git a/pkg/barback/test/package_graph/lazy_transformer_test.dart b/pkg/barback/test/package_graph/lazy_transformer_test.dart
index 1c96e02c375a589e1645356ad20d0c0cf54890ae..df249b326b0238f54ddbd09d25e4a8eb13564e06 100644
--- a/pkg/barback/test/package_graph/lazy_transformer_test.dart
+++ b/pkg/barback/test/package_graph/lazy_transformer_test.dart
@@ -175,4 +175,58 @@ main() {
buildShouldFail([isTransformerException(equals(LazyBadTransformer.ERROR))]);
expect(transformer.numRuns, completion(equals(0)));
});
+
+ test("a lazy transformer passes through inputs it doesn't apply to", () {
+ initGraph(["app|foo.txt"], {"app": [
+ [new LazyRewriteTransformer("blub", "blab")]
+ ]});
+
+ updateSources(["app|foo.txt"]);
+ expectAsset("app|foo.txt");
+ buildShouldSucceed();
+ });
+
+ test("a lazy transformer passes through inputs it doesn't overwrite", () {
+ initGraph(["app|foo.txt"], {"app": [
+ [new LazyRewriteTransformer("txt", "out")]
+ ]});
+
+ updateSources(["app|foo.txt"]);
+ expectAsset("app|foo.txt");
+ buildShouldSucceed();
+ });
+
+ test("a lazy transformer doesn't pass through inputs it overwrites", () {
+ initGraph(["app|foo.txt"], {"app": [
+ [new LazyRewriteTransformer("txt", "txt")]
+ ]});
+
+ updateSources(["app|foo.txt"]);
+ expectAsset("app|foo.txt", "foo.txt");
+ buildShouldSucceed();
+ });
+
+ test("a lazy transformer doesn't pass through inputs it consumes", () {
+ initGraph(["app|foo.txt"], {"app": [
+ [new LazyRewriteTransformer("txt", "out")..consumePrimary = true]
+ ]});
+
+ updateSources(["app|foo.txt"]);
+ expectNoAsset("app|foo.txt");
+ buildShouldSucceed();
+ });
+
+ test("a lazy transformer that doesn't apply does nothing when forced", () {
+ initGraph(["app|foo.txt"], {"app": [
+ [new LazyRewriteTransformer("blub", "blab")]
+ ]});
+
+ updateSources(["app|foo.txt"]);
+ expectNoAsset("app|foo.blab");
+
+ // Getting all assets will force every lazy transformer. This shouldn't
+ // cause the rewrite to apply, because foo.txt isn't primary.
+ expectAllAssets(["app|foo.txt"]);
+ buildShouldSucceed();
+ });
}
« no previous file with comments | « pkg/barback/test/package_graph/errors_test.dart ('k') | pkg/barback/test/transformer/lazy_rewrite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698