Index: pkg/barback/test/package_graph/group_test.dart |
diff --git a/pkg/barback/test/package_graph/group_test.dart b/pkg/barback/test/package_graph/group_test.dart |
index 2f9fa4064d9a4ed8e2dd65b20e5d88bf8bf441d4..bc77c37aa460c3d2e81c295957c755f5a9d355a6 100644 |
--- a/pkg/barback/test/package_graph/group_test.dart |
+++ b/pkg/barback/test/package_graph/group_test.dart |
@@ -21,6 +21,7 @@ main() { |
])] |
]}); |
updateSources(["app|foo.a"]); |
+ expectNoAsset("app|foo.b"); |
expectAsset("app|foo.c", "foo.b.c"); |
buildShouldSucceed(); |
}); |
@@ -34,6 +35,7 @@ main() { |
[new RewriteTransformer("c", "d")] |
]}); |
updateSources(["app|foo.a"]); |
+ expectNoAsset("app|foo.c"); |
expectAsset("app|foo.d", "foo.b.c.d"); |
buildShouldSucceed(); |
}); |
@@ -47,6 +49,7 @@ main() { |
])] |
]}); |
updateSources(["app|foo.a"]); |
+ expectNoAsset("app|foo.b"); |
expectAsset("app|foo.d", "foo.b.c.d"); |
buildShouldSucceed(); |
}); |
@@ -97,6 +100,7 @@ main() { |
]}); |
updateSources(["app|foo.a"]); |
+ expectNoAsset("app|foo.b"); |
expectAsset("app|foo.c", "foo.b.c"); |
buildShouldSucceed(); |
@@ -117,6 +121,7 @@ main() { |
]}); |
updateSources(["app|foo.a", "app|bar.x"]); |
+ expectNoAsset("app|foo.b"); |
expectAsset("app|foo.c", "foo.b.c"); |
expectAsset("app|bar.c", "bar.b.c"); |
buildShouldSucceed(); |
@@ -191,50 +196,34 @@ main() { |
buildShouldSucceed(); |
}); |
- // TODO(nweiz): re-enable this test when a transformer can consume its |
- // primary input (issue 16612). |
- // test("parallel groups' intermediate assets can't collide", () { |
- // initGraph(["app|foo.a", "app|foo.x"], {"app": [ |
- // [new TransformerGroup([ |
- // [new RewriteTransformer("a", "b")], |
- // [new RewriteTransformer("b", "c")] |
- // ]), new TransformerGroup([ |
- // [new RewriteTransformer("x", "b")], |
- // [new RewriteTransformer("b", "z")] |
- // ])] |
- // ]}); |
- // updateSources(["app|foo.a", "app|foo.x"]); |
- // expectAsset("app|foo.c", "foo.b.c"); |
- // expectAsset("app|foo.z", "foo.b.z"); |
- // buildShouldSucceed(); |
- // }); |
- }); |
- |
- group("pass-through", () { |
- test("passes an unused input through a group", () { |
- initGraph(["app|foo.x"], {"app": [ |
+ test("parallel groups' intermediate assets can't collide", () { |
+ initGraph(["app|foo.a", "app|foo.x"], {"app": [ |
[new TransformerGroup([ |
[new RewriteTransformer("a", "b")], |
[new RewriteTransformer("b", "c")] |
+ ]), new TransformerGroup([ |
+ [new RewriteTransformer("x", "b")], |
+ [new RewriteTransformer("b", "z")] |
])] |
]}); |
- updateSources(["app|foo.x"]); |
- expectNoAsset("app|foo.c"); |
- expectAsset("app|foo.x", "foo"); |
+ updateSources(["app|foo.a", "app|foo.x"]); |
+ expectAsset("app|foo.c", "foo.b.c"); |
+ expectAsset("app|foo.z", "foo.b.z"); |
buildShouldSucceed(); |
}); |
+ }); |
- test("passes non-overwritten inputs through a group", () { |
- initGraph(["app|foo.a"], {"app": [ |
+ group("pass-through", () { |
+ test("passes an unused input through a group", () { |
+ initGraph(["app|foo.x"], {"app": [ |
[new TransformerGroup([ |
[new RewriteTransformer("a", "b")], |
[new RewriteTransformer("b", "c")] |
])] |
]}); |
- updateSources(["app|foo.a"]); |
- expectAsset("app|foo.a", "foo"); |
- expectAsset("app|foo.b", "foo.b"); |
- expectAsset("app|foo.c", "foo.b.c"); |
+ updateSources(["app|foo.x"]); |
+ expectNoAsset("app|foo.c"); |
+ expectAsset("app|foo.x", "foo"); |
buildShouldSucceed(); |
}); |
@@ -270,32 +259,35 @@ main() { |
buildShouldSucceed(); |
}); |
- test("doesn't pass through an input that's overwritten by a group but not " |
- "by transformers", () { |
+ test("doesn't pass through an input that's used by a group but not by " |
+ "transformers", () { |
initGraph(["app|foo.a"], {"app": [[ |
new TransformerGroup([ |
- [new RewriteTransformer("a", "a")], |
+ [new RewriteTransformer("a", "b")], |
+ [new RewriteTransformer("b", "c")] |
]), |
new RewriteTransformer("x", "y") |
]]}); |
updateSources(["app|foo.a"]); |
+ expectNoAsset("app|foo.a"); |
expectNoAsset("app|foo.y"); |
- expectAsset("app|foo.a", "foo.a"); |
+ expectAsset("app|foo.c", "foo.b.c"); |
buildShouldSucceed(); |
}); |
- test("doesn't pass through an input that's overwritten by transformers but " |
- "not by a group", () { |
+ test("doesn't pass through an input that's used by transformers but not by " |
+ "a group", () { |
initGraph(["app|foo.x"], {"app": [[ |
new TransformerGroup([ |
[new RewriteTransformer("a", "b")], |
[new RewriteTransformer("b", "c")] |
]), |
- new RewriteTransformer("x", "x") |
+ new RewriteTransformer("x", "y") |
]]}); |
updateSources(["app|foo.x"]); |
+ expectNoAsset("app|foo.x"); |
expectNoAsset("app|foo.c"); |
- expectAsset("app|foo.x", "foo.x"); |
+ expectAsset("app|foo.y", "foo.y"); |
buildShouldSucceed(); |
}); |
@@ -323,6 +315,31 @@ main() { |
expectAsset("app|foo.a", "foo.a"); |
buildShouldSucceed(); |
}); |
+ |
+ test("doesn't pass-through an asset that ceases to be forwarded due to a " |
+ "resolved collision", () { |
+ initGraph({ |
+ "app|foo.a": "foo.a", |
+ "app|foo.x": "foo.x" |
+ }, {"app": [ |
+ [new TransformerGroup([[ |
+ new CheckContentAndRenameTransformer( |
+ "a", "new foo.a", "z", "modified foo.a"), |
+ new RewriteTransformer('x', 'a') |
+ ]])] |
+ ]}); |
+ |
+ updateSources(["app|foo.a", "app|foo.x"]); |
+ expectAsset("app|foo.a", "foo.a"); |
+ expectNoAsset("app|foo.z"); |
+ buildShouldFail([isAssetCollisionException("app|foo.a")]); |
+ |
+ modifyAsset('app|foo.a', 'new foo.a'); |
+ updateSources(["app|foo.a"]); |
+ expectAsset("app|foo.a", "foo.x.a"); |
+ expectAsset("app|foo.z", "modified foo.a"); |
+ buildShouldSucceed(); |
+ }); |
}); |
test("runs transforms in an added group", () { |
@@ -366,8 +383,7 @@ main() { |
expect(rewrite2.numRuns, completion(equals(1))); |
}); |
- test("doesn't pass through an input that's overwritten by an added group", |
- () { |
+ test("doesn't pass through an input that's used by an added group", () { |
var rewrite = new RewriteTransformer("x", "z"); |
initGraph(["app|foo.a"], {"app": [[rewrite]]}); |
@@ -376,9 +392,13 @@ main() { |
buildShouldSucceed(); |
updateTransformers("app", [ |
- [rewrite, new TransformerGroup([[new RewriteTransformer("a", "a")]])] |
+ [rewrite, new TransformerGroup([ |
+ [new RewriteTransformer("a", "b")], |
+ [new RewriteTransformer("b", "c")] |
+ ])] |
]); |
- expectAsset("app|foo.a", "foo.a"); |
+ expectNoAsset("app|foo.a"); |
+ expectAsset("app|foo.c", "foo.b.c"); |
buildShouldSucceed(); |
}); |