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

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

Issue 180473003: Barback transforms now pass through the primary input by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code reivew Created 6 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 | « pkg/barback/lib/src/phase_output.dart ('k') | pkg/barback/test/package_graph/errors_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/test/package_graph/add_remove_transform_test.dart
diff --git a/pkg/barback/test/package_graph/add_remove_transform_test.dart b/pkg/barback/test/package_graph/add_remove_transform_test.dart
index ac0076cd8f1f6df3d82c75db435a69a8fc121cf8..c593907594809cb4789ea224679934687dc603a1 100644
--- a/pkg/barback/test/package_graph/add_remove_transform_test.dart
+++ b/pkg/barback/test/package_graph/add_remove_transform_test.dart
@@ -20,7 +20,6 @@ main() {
updateTransformers("app", [[new RewriteTransformer("blub", "blab")]]);
expectAsset("app|foo.blab", "foo.blab");
- expectNoAsset("app|foo.blub");
buildShouldSucceed();
});
@@ -43,12 +42,10 @@ main() {
updateSources(["app|foo.blub"]);
expectAsset("app|foo.blab", "foo.blab");
- expectNoAsset("app|foo.blub");
buildShouldSucceed();
updateTransformers("app", [[rewrite]]);
expectAsset("app|foo.blab", "foo.blab");
- expectNoAsset("app|foo.blub");
buildShouldSucceed();
expect(rewrite.numRuns, completion(equals(1)));
@@ -61,7 +58,6 @@ main() {
updateSources(["app|foo.txt"]);
expectAsset("app|foo.blab", "foo.blub.blab");
- expectNoAsset("app|foo.blub");
buildShouldSucceed();
updateTransformers("app", [[rewrite2], [rewrite1]]);
@@ -94,7 +90,6 @@ main() {
updateSources(["app|foo.blub"]);
expectAsset("app|foo.blab", "foo.blab");
- expectNoAsset("app|foo.blub");
buildShouldSucceed();
updateTransformers("app", []);
@@ -192,22 +187,6 @@ main() {
buildShouldSucceed();
});
- test("a new transformer can see pass-through assets", () {
- var rewrite = new RewriteTransformer("zip", "zap");
- initGraph(["app|foo.blub"], {"app": [[rewrite]]});
-
- updateSources(["app|foo.blub"]);
- buildShouldSucceed();
-
- updateTransformers("app", [
- [rewrite],
- [new RewriteTransformer("blub", "blab")]
- ]);
- expectAsset("app|foo.blab", "foo.blab");
- expectNoAsset("app|foo.blub");
- buildShouldSucceed();
- });
-
test("a cross-package transform sees a new transformer in a new phase", () {
var rewrite = new RewriteTransformer("inc", "inc");
initGraph({
@@ -253,6 +232,108 @@ main() {
buildShouldSucceed();
});
+ group("pass-through", () {
+ test("a new transformer can see pass-through assets", () {
+ var rewrite = new RewriteTransformer("zip", "zap");
+ initGraph(["app|foo.blub"], {"app": [[rewrite]]});
+
+ updateSources(["app|foo.blub"]);
+ buildShouldSucceed();
+
+ updateTransformers("app", [
+ [rewrite],
+ [new RewriteTransformer("blub", "blab")]
+ ]);
+ expectAsset("app|foo.blab", "foo.blab");
+ buildShouldSucceed();
+ });
+
+ test("a new transformer can overwrite an old asset", () {
+ var rewrite = new RewriteTransformer("zip", "zap");
+ initGraph(["app|foo.txt"], {"app": [[rewrite]]});
+
+ updateSources(["app|foo.txt"]);
+ expectAsset("app|foo.txt", "foo");
+ buildShouldSucceed();
+
+ // Add a transformer that will overwrite the previously-passed-through
+ // "foo.txt" asset. The transformed asset should be emitted, not the
+ // passed-through asset.
+ updateTransformers("app", [
+ [rewrite, new RewriteTransformer("txt", "txt")]
+ ]);
+ expectAsset("app|foo.txt", "foo.txt");
+ buildShouldSucceed();
+ });
+
+ test("passes an asset through when an overwriting transform is removed",
+ () {
+ initGraph(["app|foo.txt"], {
+ "app": [[new RewriteTransformer("txt", "txt")]]
+ });
+
+ updateSources(["app|foo.txt"]);
+ expectAsset("app|foo.txt", "foo.txt");
+ buildShouldSucceed();
+
+ updateTransformers("app", [[]]);
+ expectAsset("app|foo.txt", "foo");
+ buildShouldSucceed();
+ });
+
+ test("passes an asset through when its overwriting transform is removed "
+ "during apply", () {
+ var rewrite = new RewriteTransformer("txt", "txt");
+ initGraph(["app|foo.txt"], {"app": [[rewrite]]});
+
+ rewrite.pauseApply();
+ updateSources(["app|foo.txt"]);
+ expectAssetDoesNotComplete("app|foo.txt");
+
+ updateTransformers("app", [[]]);
+ rewrite.resumeApply();
+ expectAsset("app|foo.txt", "foo");
+ buildShouldSucceed();
+ });
+
+ test("doesn't pass an asset through when its overwriting transform is "
+ "removed during apply if another transform overwrites it", () {
+ var rewrite1 = new RewriteTransformer("txt", "txt");
+ var rewrite2 = new RewriteTransformer("txt", "txt");
+ initGraph(["app|foo.txt"], {"app": [[rewrite1, rewrite2]]});
+
+ rewrite1.pauseApply();
+ updateSources(["app|foo.txt"]);
+ expectAssetDoesNotComplete("app|foo.txt");
+ // Ensure we're waiting on [rewrite1.apply]
+ schedule(pumpEventQueue);
+
+ updateTransformers("app", [[rewrite2]]);
+ rewrite1.resumeApply();
+ expectAsset("app|foo.txt", "foo.txt");
+ buildShouldSucceed();
+ });
+
+ test("doesn't pass an asset through when one overwriting transform is "
+ "removed if another transform still overwrites it", () {
+ var rewrite = new RewriteTransformer("txt", "txt");
+ initGraph(["app|foo.txt"], {"app": [[
+ rewrite,
+ new RewriteTransformer("txt", "txt")
+ ]]});
+
+ updateSources(["app|foo.txt"]);
+ // This could be either the output of [CheckContentTransformer] or
+ // [RewriteTransformer], depending which completes first.
+ expectAsset("app|foo.txt", anything);
+ buildShouldFail([isAssetCollisionException("app|foo.txt")]);
+
+ updateTransformers("app", [[rewrite]]);
+ expectAsset("app|foo.txt", "foo.txt");
+ buildShouldSucceed();
+ });
+ });
+
// Regression test.
test("a phase is added, then an input is removed and re-added", () {
var rewrite = new RewriteTransformer("txt", "mid");
« no previous file with comments | « pkg/barback/lib/src/phase_output.dart ('k') | pkg/barback/test/package_graph/errors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698