| Index: pkg/barback/test/package_graph/errors_test.dart
|
| diff --git a/pkg/barback/test/package_graph/errors_test.dart b/pkg/barback/test/package_graph/errors_test.dart
|
| index 2728859aa2849987793c4e06fd1ed5907d5bb4f6..d1bb5c25546c50a4b2c1469ab4fb36ac0725c4a9 100644
|
| --- a/pkg/barback/test/package_graph/errors_test.dart
|
| +++ b/pkg/barback/test/package_graph/errors_test.dart
|
| @@ -173,164 +173,11 @@ main() {
|
| ]);
|
| });
|
|
|
| - test("a collision returns the first-produced output", () {
|
| - var rewrite1 = new RewriteTransformer("one", "out");
|
| - var rewrite2 = new RewriteTransformer("two", "out");
|
| - initGraph({
|
| - "app|foo.one": "one",
|
| - "app|foo.two": "two"
|
| - }, {"app": [[rewrite1, rewrite2]]});
|
| -
|
| - rewrite1.pauseApply();
|
| - updateSources(["app|foo.one", "app|foo.two"]);
|
| - // Wait long enough to ensure that rewrite2 has completed.
|
| - schedule(pumpEventQueue);
|
| -
|
| - rewrite1.resumeApply();
|
| - expectAsset("app|foo.out", "two.out");
|
| - buildShouldFail([isAssetCollisionException("app|foo.out")]);
|
| -
|
| - // Even after the collision is discovered, the first-produced output should
|
| - // be returned.
|
| - expectAsset("app|foo.out", "two.out");
|
| -
|
| - // Even if the other output is updated more recently, the first output
|
| - // should continue to take precedence.
|
| - updateSources(["app|foo.one"]);
|
| - expectAsset("app|foo.out", "two.out");
|
| - });
|
| -
|
| - test("a collision that is later resolved produces an output", () {
|
| - initGraph({
|
| - "app|foo.one": "one",
|
| - "app|foo.two": "two"
|
| - }, {"app": [
|
| - [
|
| - new RewriteTransformer("one", "out"),
|
| - new RewriteTransformer("two", "out")
|
| - ]
|
| - ]});
|
| -
|
| - updateSources(["app|foo.one"]);
|
| - expectAsset("app|foo.out", "one.out");
|
| - buildShouldSucceed();
|
| -
|
| - updateSources(["app|foo.two"]);
|
| - expectAsset("app|foo.out", "one.out");
|
| - buildShouldFail([isAssetCollisionException("app|foo.out")]);
|
| -
|
| - removeSources(["app|foo.one"]);
|
| - expectAsset("app|foo.out", "two.out");
|
| - buildShouldSucceed();
|
| - });
|
| -
|
| - test("a collision that is later resolved runs transforms", () {
|
| - initGraph({
|
| - "app|foo.one": "one",
|
| - "app|foo.two": "two"
|
| - }, {"app": [
|
| - [
|
| - new RewriteTransformer("one", "mid"),
|
| - new RewriteTransformer("two", "mid")
|
| - ],
|
| - [new RewriteTransformer("mid", "out")]
|
| - ]});
|
| -
|
| - updateSources(["app|foo.one"]);
|
| - expectAsset("app|foo.out", "one.mid.out");
|
| - buildShouldSucceed();
|
| -
|
| - updateSources(["app|foo.two"]);
|
| - expectAsset("app|foo.out", "one.mid.out");
|
| - buildShouldFail([isAssetCollisionException("app|foo.mid")]);
|
| -
|
| - removeSources(["app|foo.one"]);
|
| - expectAsset("app|foo.out", "two.mid.out");
|
| - buildShouldSucceed();
|
| - });
|
| -
|
| - test("a collision that is partially resolved returns the second completed "
|
| - "output", () {
|
| - var rewrite1 = new RewriteTransformer("one", "out");
|
| - var rewrite2 = new RewriteTransformer("two", "out");
|
| - var rewrite3 = new RewriteTransformer("three", "out");
|
| - initGraph({
|
| - "app|foo.one": "one",
|
| - "app|foo.two": "two",
|
| - "app|foo.three": "three"
|
| - }, {"app": [[rewrite1, rewrite2, rewrite3]]});
|
| -
|
| - // Make rewrite3 the most-recently-completed transformer from the first run.
|
| - rewrite2.pauseApply();
|
| - rewrite3.pauseApply();
|
| - updateSources(["app|foo.one", "app|foo.two", "app|foo.three"]);
|
| - schedule(pumpEventQueue);
|
| - rewrite2.resumeApply();
|
| - schedule(pumpEventQueue);
|
| - rewrite3.resumeApply();
|
| - buildShouldFail([
|
| - isAssetCollisionException("app|foo.out"),
|
| - isAssetCollisionException("app|foo.out")
|
| - ]);
|
| -
|
| - // Then update rewrite3 in a separate build. rewrite2 should still be the
|
| - // next version of foo.out in line.
|
| - // TODO(nweiz): Should this emit a collision error as well? Or should they
|
| - // only be emitted when a file is added or removed?
|
| - updateSources(["app|foo.three"]);
|
| - buildShouldSucceed();
|
| -
|
| - removeSources(["app|foo.one"]);
|
| - expectAsset("app|foo.out", "two.out");
|
| - buildShouldFail([isAssetCollisionException("app|foo.out")]);
|
| - });
|
| -
|
| - test("a collision with a pass-through asset returns the pass-through asset",
|
| - () {
|
| - initGraph([
|
| - "app|foo.txt",
|
| - "app|foo.in"
|
| - ], {"app": [
|
| - [new RewriteTransformer("in", "txt")]
|
| - ]});
|
| -
|
| - updateSources(["app|foo.txt", "app|foo.in"]);
|
| - expectAsset("app|foo.txt", "foo");
|
| - buildShouldFail([isAssetCollisionException("app|foo.txt")]);
|
| - });
|
| -
|
| - test("a new pass-through asset that collides returns the previous asset", () {
|
| - initGraph([
|
| - "app|foo.txt",
|
| - "app|foo.in"
|
| - ], {"app": [
|
| - [new RewriteTransformer("in", "txt")]
|
| - ]});
|
| -
|
| - updateSources(["app|foo.in"]);
|
| - expectAsset("app|foo.txt", "foo.txt");
|
| - buildShouldSucceed();
|
| -
|
| - updateSources(["app|foo.txt"]);
|
| - expectAsset("app|foo.txt", "foo.txt");
|
| - buildShouldFail([isAssetCollisionException("app|foo.txt")]);
|
| - });
|
| -
|
| - test("a new transform output that collides with a pass-through asset returns "
|
| - "the pass-through asset", () {
|
| - initGraph([
|
| - "app|foo.txt",
|
| - "app|foo.in"
|
| - ], {"app": [
|
| - [new RewriteTransformer("in", "txt")]
|
| - ]});
|
| + test("an asset isn't passed through a transformer with an error", () {
|
| + initGraph(["app|foo.txt",], {"app": [[new BadTransformer([])]]});
|
|
|
| updateSources(["app|foo.txt"]);
|
| - expectAsset("app|foo.txt", "foo");
|
| - buildShouldSucceed();
|
| -
|
| - updateSources(["app|foo.in"]);
|
| - expectAsset("app|foo.txt", "foo");
|
| - buildShouldFail([isAssetCollisionException("app|foo.txt")]);
|
| + expectNoAsset("app|foo.txt");
|
| + buildShouldFail([isTransformerException(equals(BadTransformer.ERROR))]);
|
| });
|
| }
|
|
|