Chromium Code Reviews| Index: pkg/barback/test/package_graph/transform/pass_through_test.dart |
| diff --git a/pkg/barback/test/package_graph/transform/pass_through_test.dart b/pkg/barback/test/package_graph/transform/pass_through_test.dart |
| index eb90418385fd1d0b89e218f5253f261f46f2840a..c8b1d7ecc139c905df267bd3c368731a134b1caa 100644 |
| --- a/pkg/barback/test/package_graph/transform/pass_through_test.dart |
| +++ b/pkg/barback/test/package_graph/transform/pass_through_test.dart |
| @@ -270,4 +270,148 @@ main() { |
| expectAsset("app|foo.txt", "foo.txt"); |
| buildShouldSucceed(); |
| }); |
| + |
|
Bob Nystrom
2014/03/07 21:54:11
Might be worth making a separate suite for these.
nweiz
2014/03/11 21:44:05
Done.
|
| + group("consumeInput", () { |
| + test("a transform consumes its input without overwriting it", () { |
| + initGraph([ |
| + "app|foo.txt" |
| + ], { |
| + "app": [[new RewriteTransformer("txt", "out")..consumePrimary = true]] |
| + }); |
| + |
| + updateSources(["app|foo.txt"]); |
| + expectAsset("app|foo.out", "foo.out"); |
| + expectNoAsset("app|foo.txt"); |
| + buildShouldSucceed(); |
| + }); |
| + |
| + test("a transform consumes its input while a sibling overwrites it", () { |
| + initGraph([ |
| + "app|foo.txt" |
| + ], { |
| + "app": [[ |
| + new RewriteTransformer("txt", "out")..consumePrimary = true, |
| + new RewriteTransformer("txt", "txt") |
| + ]] |
| + }); |
| + |
| + updateSources(["app|foo.txt"]); |
| + expectAsset("app|foo.out", "foo.out"); |
| + expectAsset("app|foo.txt", "foo.txt"); |
| + buildShouldSucceed(); |
| + }); |
| + |
| + test("a transform stops consuming its input", () { |
| + initGraph({ |
| + "app|foo.txt": "yes" |
| + }, { |
| + "app": [[ |
| + new ConditionallyConsumePrimaryTransformer("txt", "out", "yes") |
| + ]] |
| + }); |
| + |
| + updateSources(["app|foo.txt"]); |
| + expectAsset("app|foo.out", "yes.out"); |
| + expectNoAsset("app|foo.txt"); |
| + buildShouldSucceed(); |
| + |
| + modifyAsset("app|foo.txt", "no"); |
| + updateSources(["app|foo.txt"]); |
| + expectAsset("app|foo.out", "no.out"); |
| + expectAsset("app|foo.txt", "no"); |
| + buildShouldSucceed(); |
| + }); |
| + |
| + test("a transform stops consuming its input but a sibling is still " |
| + "consuming it", () { |
|
Bob Nystrom
2014/03/07 21:54:11
It's a subset of this test, but it might be nice t
nweiz
2014/03/11 21:44:05
Done.
|
| + initGraph({ |
| + "app|foo.txt": "yes" |
| + }, { |
| + "app": [[ |
| + new RewriteTransformer("txt", "one")..consumePrimary = true, |
| + new ConditionallyConsumePrimaryTransformer("txt", "two", "yes") |
| + ]] |
| + }); |
| + |
| + updateSources(["app|foo.txt"]); |
| + expectAsset("app|foo.one", "yes.one"); |
| + expectAsset("app|foo.two", "yes.two"); |
| + expectNoAsset("app|foo.txt"); |
| + buildShouldSucceed(); |
| + |
| + modifyAsset("app|foo.txt", "no"); |
| + updateSources(["app|foo.txt"]); |
| + expectAsset("app|foo.one", "no.one"); |
| + expectAsset("app|foo.two", "no.two"); |
| + expectNoAsset("app|foo.txt"); |
| + buildShouldSucceed(); |
| + }); |
| + |
| + test("a transform consumes its input and emits nothing", () { |
| + initGraph([ |
| + "app|foo.txt" |
| + ], { |
| + "app": [[new EmitNothingTransformer("txt")..consumePrimary = true]] |
| + }); |
| + |
| + updateSources(["app|foo.txt"]); |
| + expectNoAsset("app|foo.txt"); |
| + buildShouldSucceed(); |
| + }); |
| + |
| + test("a transform consumes its input, then is removed", () { |
| + initGraph([ |
| + "app|foo.txt" |
| + ], { |
| + "app": [[new RewriteTransformer("txt", "out")..consumePrimary = true]] |
| + }); |
| + |
| + updateSources(["app|foo.txt"]); |
| + expectAsset("app|foo.out", "foo.out"); |
| + expectNoAsset("app|foo.txt"); |
| + buildShouldSucceed(); |
| + |
| + updateTransformers("app", [[]]); |
| + expectNoAsset("app|foo.out"); |
| + expectAsset("app|foo.txt", "foo"); |
| + buildShouldSucceed(); |
| + }); |
| + |
| + test("a transform consumes its input and emits nothing, then is removed", |
| + () { |
| + initGraph([ |
| + "app|foo.txt" |
| + ], { |
| + "app": [[new EmitNothingTransformer("txt")..consumePrimary = true]] |
| + }); |
| + |
| + updateSources(["app|foo.txt"]); |
| + expectNoAsset("app|foo.txt"); |
| + buildShouldSucceed(); |
| + |
| + updateTransformers("app", [[]]); |
| + expectAsset("app|foo.txt", "foo"); |
| + buildShouldSucceed(); |
| + }); |
| + |
| + test("a transform which consumes its input is added", () { |
| + initGraph([ |
| + "app|foo.txt" |
| + ], { |
| + "app": [[]] |
| + }); |
| + |
| + updateSources(["app|foo.txt"]); |
| + expectNoAsset("app|foo.out"); |
| + expectAsset("app|foo.txt", "foo"); |
| + buildShouldSucceed(); |
| + |
| + updateTransformers("app", [[ |
| + new RewriteTransformer("txt", "out")..consumePrimary = true |
| + ]]); |
| + expectAsset("app|foo.out", "foo.out"); |
| + expectNoAsset("app|foo.txt"); |
| + buildShouldSucceed(); |
| + }); |
| + }); |
| } |