Index: pkg/barback/test/package_graph/declaring_transformer_test.dart |
diff --git a/pkg/barback/test/package_graph/declaring_transformer_test.dart b/pkg/barback/test/package_graph/declaring_transformer_test.dart |
index dc180aee2151009b4dd7800b556320f97686b714..9a8535f7dd2487703df338e4a76d7bb6f416938b 100644 |
--- a/pkg/barback/test/package_graph/declaring_transformer_test.dart |
+++ b/pkg/barback/test/package_graph/declaring_transformer_test.dart |
@@ -191,14 +191,16 @@ main() { |
[declaring] |
]}); |
- // Start [declaring] running, because its input became available. |
declaring.pauseApply(); |
updateSources(["app|foo.in"]); |
// Give the transformers time to declare their assets. |
schedule(pumpEventQueue); |
+ // Start [declaring] running, because its input became available. |
expectAsset("app|out.one", "app|out.one"); |
- expectAssetDoesNotComplete("app|out.three"); |
+ |
+ // Make sure we're blocking on [declaring.apply]. |
+ schedule(pumpEventQueue); |
// Now [declaring]'s input is dirty, so it shouldn't re-run without an |
// explicit request. |
@@ -220,6 +222,42 @@ main() { |
expect(declaring.numRuns, completion(equals(2))); |
}); |
+ test("a declaring transformer following a lazy transformer does re-run if " |
+ "its input becomes available, it's forced, and then its input becomes " |
+ "unavailable", () { |
+ var declaring = new DeclaringRewriteTransformer("two", "three"); |
+ initGraph(["app|foo.in"], {"app": [ |
+ [new LazyAssetsTransformer(["app|out.one", "app|out.two"])], |
+ [declaring] |
+ ]}); |
+ |
+ declaring.pauseApply(); |
+ updateSources(["app|foo.in"]); |
+ |
+ // Give the transformers time to declare their assets. |
+ schedule(pumpEventQueue); |
+ |
+ // Start [declaring] running, because its input became available. |
+ expectAsset("app|out.one", "app|out.one"); |
+ |
+ // This shouldn't complete because [declaring.apply] is paused, but it |
+ // should force the transformer. |
+ expectAssetDoesNotComplete("app|out.three"); |
+ |
+ // Make sure we're blocking on [declaring.apply] |
+ schedule(pumpEventQueue); |
+ |
+ // Now [declaring]'s input is dirty, so it shouldn't re-run without an |
+ // explicit request. |
+ updateSources(["app|foo.in"]); |
+ declaring.resumeApply(); |
+ buildShouldSucceed(); |
+ |
+ // [declaring] should have run twice, once for its original input and once |
+ // after the input changed because it was forced. |
+ expect(declaring.numRuns, completion(equals(2))); |
+ }); |
+ |
group("with an error in declareOutputs", () { |
test("still runs apply", () { |
initGraph(["app|foo.txt"], {"app": [[ |