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

Unified Diff: packages/barback/test/package_graph/lazy_transformer_test.dart

Issue 3015713002: Roll to pickup pool changes
Patch Set: Created 3 years, 3 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
Index: packages/barback/test/package_graph/lazy_transformer_test.dart
diff --git a/packages/barback/test/package_graph/lazy_transformer_test.dart b/packages/barback/test/package_graph/lazy_transformer_test.dart
index 1503c4796f3f53560f184b2070ecd60b4dfac656..e1f16bb5ca4fba75d397b6de4d9b674b6eebf338 100644
--- a/packages/barback/test/package_graph/lazy_transformer_test.dart
+++ b/packages/barback/test/package_graph/lazy_transformer_test.dart
@@ -5,7 +5,6 @@
library barback.test.package_graph.lazy_asset_test;
import 'package:barback/barback.dart';
-import 'package:barback/src/utils.dart';
import 'package:scheduled_test/scheduled_test.dart';
import '../utils.dart';
@@ -13,9 +12,13 @@ import '../utils.dart';
main() {
initConfig();
test("requesting a lazy asset should cause it to be generated", () {
- initGraph(["app|foo.blub"], {"app": [
- [new LazyRewriteTransformer("blub", "blab")]
- ]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("blub", "blab")]
+ ]
+ });
updateSources(["app|foo.blub"]);
expectAsset("app|foo.blab", "foo.blab");
buildShouldSucceed();
@@ -23,17 +26,30 @@ main() {
test("calling getAllAssets should cause a lazy asset to be generated", () {
var transformer = new LazyRewriteTransformer("blub", "blab");
- initGraph(["app|foo.blub"], {"app": [[transformer]]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [transformer]
+ ]
+ });
updateSources(["app|foo.blub"]);
expectAllAssets(["app|foo.blub", "app|foo.blab"]);
buildShouldSucceed();
expect(transformer.numRuns, completion(equals(1)));
});
- test("requesting a lazy asset multiple times should only cause it to be "
+ test(
+ "requesting a lazy asset multiple times should only cause it to be "
"generated once", () {
var transformer = new LazyRewriteTransformer("blub", "blab");
- initGraph(["app|foo.blub"], {"app": [[transformer]]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [transformer]
+ ]
+ });
updateSources(["app|foo.blub"]);
expectAsset("app|foo.blab", "foo.blab");
expectAsset("app|foo.blab", "foo.blab");
@@ -43,10 +59,14 @@ main() {
});
test("a lazy asset can be consumed by a non-lazy transformer", () {
- initGraph(["app|foo.blub"], {"app": [
- [new LazyRewriteTransformer("blub", "blab")],
- [new RewriteTransformer("blab", "blib")]
- ]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("blub", "blab")],
+ [new RewriteTransformer("blab", "blib")]
+ ]
+ });
updateSources(["app|foo.blub"]);
expectAsset("app|foo.blib", "foo.blab.blib");
buildShouldSucceed();
@@ -54,7 +74,13 @@ main() {
test("a lazy asset isn't eagerly compiled", () {
var transformer = new LazyRewriteTransformer("blub", "blab");
- initGraph(["app|foo.blub"], {"app": [[transformer]]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [transformer]
+ ]
+ });
updateSources(["app|foo.blub"]);
buildShouldSucceed();
expect(transformer.numRuns, completion(equals(0)));
@@ -62,9 +88,17 @@ main() {
test("a lazy asset emitted by a group isn't eagerly compiled", () {
var transformer = new LazyRewriteTransformer("blub", "blab");
- initGraph(["app|foo.blub"], {"app": [
- [new TransformerGroup([[transformer]])]
- ]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [
+ new TransformerGroup([
+ [transformer]
+ ])
+ ]
+ ]
+ });
updateSources(["app|foo.blub"]);
buildShouldSucceed();
expect(transformer.numRuns, completion(equals(0)));
@@ -73,48 +107,71 @@ main() {
test("a lazy asset piped into a non-lazy transformer is eagerly compiled",
() {
var transformer = new LazyRewriteTransformer("blub", "blab");
- initGraph(["app|foo.blub"], {"app": [
- [transformer],
- [new RewriteTransformer("blab", "blib")]
- ]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [transformer],
+ [new RewriteTransformer("blab", "blib")]
+ ]
+ });
updateSources(["app|foo.blub"]);
buildShouldSucceed();
expect(transformer.numRuns, completion(equals(1)));
});
- test("a lazy asset piped into a declaring transformer isn't eagerly "
+ test(
+ "a lazy asset piped into a declaring transformer isn't eagerly "
"compiled", () {
var transformer1 = new LazyRewriteTransformer("blub", "blab");
var transformer2 = new DeclaringRewriteTransformer("blab", "blib");
- initGraph(["app|foo.blub"], {"app": [
- [transformer1], [transformer2]
- ]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [transformer1],
+ [transformer2]
+ ]
+ });
updateSources(["app|foo.blub"]);
buildShouldSucceed();
expect(transformer1.numRuns, completion(equals(0)));
expect(transformer2.numRuns, completion(equals(0)));
});
- test("a lazy asset piped into a declaring transformer is compiled "
+ test(
+ "a lazy asset piped into a declaring transformer is compiled "
"on-demand", () {
- initGraph(["app|foo.blub"], {"app": [
- [new LazyRewriteTransformer("blub", "blab")],
- [new DeclaringRewriteTransformer("blab", "blib")]
- ]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("blub", "blab")],
+ [new DeclaringRewriteTransformer("blab", "blib")]
+ ]
+ });
updateSources(["app|foo.blub"]);
expectAsset("app|foo.blib", "foo.blab.blib");
buildShouldSucceed();
});
- test("a lazy asset piped through many declaring transformers isn't eagerly "
+ test(
+ "a lazy asset piped through many declaring transformers isn't eagerly "
"compiled", () {
var transformer1 = new LazyRewriteTransformer("one", "two");
var transformer2 = new DeclaringRewriteTransformer("two", "three");
var transformer3 = new DeclaringRewriteTransformer("three", "four");
var transformer4 = new DeclaringRewriteTransformer("four", "five");
- initGraph(["app|foo.one"], {"app": [
- [transformer1], [transformer2], [transformer3], [transformer4]
- ]});
+ initGraph([
+ "app|foo.one"
+ ], {
+ "app": [
+ [transformer1],
+ [transformer2],
+ [transformer3],
+ [transformer4]
+ ]
+ });
updateSources(["app|foo.one"]);
buildShouldSucceed();
expect(transformer1.numRuns, completion(equals(0)));
@@ -123,49 +180,69 @@ main() {
expect(transformer4.numRuns, completion(equals(0)));
});
- test("a lazy asset piped through many declaring transformers is compiled "
+ test(
+ "a lazy asset piped through many declaring transformers is compiled "
"on-demand", () {
- initGraph(["app|foo.one"], {"app": [
- [new LazyRewriteTransformer("one", "two")],
- [new DeclaringRewriteTransformer("two", "three")],
- [new DeclaringRewriteTransformer("three", "four")],
- [new DeclaringRewriteTransformer("four", "five")]
- ]});
+ initGraph([
+ "app|foo.one"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("one", "two")],
+ [new DeclaringRewriteTransformer("two", "three")],
+ [new DeclaringRewriteTransformer("three", "four")],
+ [new DeclaringRewriteTransformer("four", "five")]
+ ]
+ });
updateSources(["app|foo.one"]);
expectAsset("app|foo.five", "foo.two.three.four.five");
buildShouldSucceed();
});
- test("a lazy asset piped into a non-lazy transformer that doesn't use its "
+ test(
+ "a lazy asset piped into a non-lazy transformer that doesn't use its "
"outputs isn't eagerly compiled", () {
var transformer = new LazyRewriteTransformer("blub", "blab");
- initGraph(["app|foo.blub"], {"app": [
- [transformer],
- [new RewriteTransformer("txt", "out")]
- ]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [transformer],
+ [new RewriteTransformer("txt", "out")]
+ ]
+ });
updateSources(["app|foo.blub"]);
buildShouldSucceed();
expect(transformer.numRuns, completion(equals(0)));
});
- test("a lazy asset piped into a non-lazy transformer that doesn't use its "
+ test(
+ "a lazy asset piped into a non-lazy transformer that doesn't use its "
"outputs is compiled on-demand", () {
- initGraph(["app|foo.blub"], {"app": [
- [new LazyRewriteTransformer("blub", "blab")],
- [new RewriteTransformer("txt", "out")]
- ]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("blub", "blab")],
+ [new RewriteTransformer("txt", "out")]
+ ]
+ });
updateSources(["app|foo.blub"]);
expectAsset("app|foo.blab", "foo.blab");
buildShouldSucceed();
});
- test("a lazy transformer followed by a non-lazy transformer is re-run "
+ test(
+ "a lazy transformer followed by a non-lazy transformer is re-run "
"eagerly", () {
var rewrite = new LazyRewriteTransformer("one", "two");
- initGraph(["app|foo.one"], {"app": [
- [rewrite],
- [new RewriteTransformer("two", "three")]
- ]});
+ initGraph([
+ "app|foo.one"
+ ], {
+ "app": [
+ [rewrite],
+ [new RewriteTransformer("two", "three")]
+ ]
+ });
updateSources(["app|foo.one"]);
expectAsset("app|foo.three", "foo.two.three");
@@ -177,13 +254,18 @@ main() {
expect(rewrite.numRuns, completion(equals(2)));
});
- test("a lazy transformer followed by a declaring transformer isn't re-run "
+ test(
+ "a lazy transformer followed by a declaring transformer isn't re-run "
"eagerly", () {
var rewrite = new LazyRewriteTransformer("one", "two");
- initGraph(["app|foo.one"], {"app": [
- [rewrite],
- [new DeclaringRewriteTransformer("two", "three")]
- ]});
+ initGraph([
+ "app|foo.one"
+ ], {
+ "app": [
+ [rewrite],
+ [new DeclaringRewriteTransformer("two", "three")]
+ ]
+ });
updateSources(["app|foo.one"]);
expectAsset("app|foo.three", "foo.two.three");
@@ -195,17 +277,27 @@ main() {
expect(rewrite.numRuns, completion(equals(1)));
});
- test("a declaring transformer added after a materialized lazy transformer "
+ test(
+ "a declaring transformer added after a materialized lazy transformer "
"is still deferred", () {
var lazy = new LazyRewriteTransformer("one", "two");
var declaring = new DeclaringRewriteTransformer("two", "three");
- initGraph(["app|foo.one"], {"app": [[lazy]]});
+ initGraph([
+ "app|foo.one"
+ ], {
+ "app": [
+ [lazy]
+ ]
+ });
updateSources(["app|foo.one"]);
expectAsset("app|foo.two", "foo.two");
buildShouldSucceed();
- updateTransformers("app", [[lazy], [declaring]]);
+ updateTransformers("app", [
+ [lazy],
+ [declaring]
+ ]);
expectAsset("app|foo.three", "foo.two.three");
buildShouldSucceed();
@@ -220,11 +312,14 @@ main() {
initGraph({
"pkg1|foo.blub": "foo",
"pkg2|a.txt": "pkg1|foo.blab"
- }, {"pkg1": [
- [new LazyRewriteTransformer("blub", "blab")],
- ], "pkg2": [
- [new ManyToOneTransformer("txt")]
- ]});
+ }, {
+ "pkg1": [
+ [new LazyRewriteTransformer("blub", "blab")],
+ ],
+ "pkg2": [
+ [new ManyToOneTransformer("txt")]
+ ]
+ });
updateSources(["pkg1|foo.blub", "pkg2|a.txt"]);
expectAsset("pkg2|a.out", "foo.blab");
@@ -235,9 +330,11 @@ main() {
initGraph({
"app|a.inc": "a",
"app|a.txt": "a.inc"
- }, {"app": [
- [new LazyManyToOneTransformer("txt")]
- ]});
+ }, {
+ "app": [
+ [new LazyManyToOneTransformer("txt")]
+ ]
+ });
updateSources(["app|a.inc", "app|a.txt"]);
expectAsset("app|a.out", "a");
@@ -246,7 +343,13 @@ main() {
test("after being materialized a lazy transformer is still lazy", () {
var transformer = new LazyRewriteTransformer("blub", "blab");
- initGraph(["app|foo.blub"], {"app": [[transformer]]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [transformer]
+ ]
+ });
updateSources(["app|foo.blub"]);
buildShouldSucceed();
@@ -264,7 +367,13 @@ main() {
test("after being materialized a lazy transformer can be materialized again",
() {
var transformer = new LazyRewriteTransformer("blub", "blab");
- initGraph(["app|foo.blub"], {"app": [[transformer]]});
+ initGraph([
+ "app|foo.blub"
+ ], {
+ "app": [
+ [transformer]
+ ]
+ });
updateSources(["app|foo.blub"]);
buildShouldSucceed();
@@ -279,20 +388,32 @@ main() {
buildShouldSucceed();
});
- test("an error emitted in a lazy transformer's declareOutputs method is "
+ test(
+ "an error emitted in a lazy transformer's declareOutputs method is "
"caught and reported", () {
- initGraph(["app|foo.txt"], {"app": [
- [new LazyBadTransformer("app|foo.out")]
- ]});
+ initGraph([
+ "app|foo.txt"
+ ], {
+ "app": [
+ [new LazyBadTransformer("app|foo.out")]
+ ]
+ });
updateSources(["app|foo.txt"]);
buildShouldFail([isTransformerException(equals(LazyBadTransformer.ERROR))]);
});
- test("an error emitted in a lazy transformer's declareOuputs method prevents "
+ test(
+ "an error emitted in a lazy transformer's declareOuputs method prevents "
"it from being materialized", () {
var transformer = new LazyBadTransformer("app|foo.out");
- initGraph(["app|foo.txt"], {"app": [[transformer]]});
+ initGraph([
+ "app|foo.txt"
+ ], {
+ "app": [
+ [transformer]
+ ]
+ });
updateSources(["app|foo.txt"]);
expectNoAsset("app|foo.out");
@@ -301,9 +422,13 @@ main() {
});
test("a lazy transformer passes through inputs it doesn't apply to", () {
- initGraph(["app|foo.txt"], {"app": [
- [new LazyRewriteTransformer("blub", "blab")]
- ]});
+ initGraph([
+ "app|foo.txt"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("blub", "blab")]
+ ]
+ });
updateSources(["app|foo.txt"]);
expectAsset("app|foo.txt");
@@ -311,9 +436,13 @@ main() {
});
test("a lazy transformer passes through inputs it doesn't overwrite", () {
- initGraph(["app|foo.txt"], {"app": [
- [new LazyRewriteTransformer("txt", "out")]
- ]});
+ initGraph([
+ "app|foo.txt"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("txt", "out")]
+ ]
+ });
updateSources(["app|foo.txt"]);
expectAsset("app|foo.txt");
@@ -321,9 +450,13 @@ main() {
});
test("a lazy transformer doesn't pass through inputs it overwrites", () {
- initGraph(["app|foo.txt"], {"app": [
- [new LazyRewriteTransformer("txt", "txt")]
- ]});
+ initGraph([
+ "app|foo.txt"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("txt", "txt")]
+ ]
+ });
updateSources(["app|foo.txt"]);
expectAsset("app|foo.txt", "foo.txt");
@@ -331,9 +464,13 @@ main() {
});
test("a lazy transformer doesn't pass through inputs it consumes", () {
- initGraph(["app|foo.txt"], {"app": [
- [new LazyRewriteTransformer("txt", "out")..consumePrimary = true]
- ]});
+ initGraph([
+ "app|foo.txt"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("txt", "out")..consumePrimary = true]
+ ]
+ });
updateSources(["app|foo.txt"]);
expectNoAsset("app|foo.txt");
@@ -341,9 +478,13 @@ main() {
});
test("a lazy transformer that doesn't apply does nothing when forced", () {
- initGraph(["app|foo.txt"], {"app": [
- [new LazyRewriteTransformer("blub", "blab")]
- ]});
+ initGraph([
+ "app|foo.txt"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("blub", "blab")]
+ ]
+ });
updateSources(["app|foo.txt"]);
expectNoAsset("app|foo.blab");
@@ -354,13 +495,22 @@ main() {
buildShouldSucceed();
});
- test("a lazy transformer that generates fewer outputs than it declares is "
+ test(
+ "a lazy transformer that generates fewer outputs than it declares is "
"forced when a declared but ungenerated output is requested", () {
- initGraph({"app|foo.txt": "no"}, {"app": [
- [new LazyCheckContentAndRenameTransformer(
- oldExtension: "txt", oldContent: "yes",
- newExtension: "out", newContent: "done")]
- ]});
+ initGraph({
+ "app|foo.txt": "no"
+ }, {
+ "app": [
+ [
+ new LazyCheckContentAndRenameTransformer(
+ oldExtension: "txt",
+ oldContent: "yes",
+ newExtension: "out",
+ newContent: "done")
+ ]
+ ]
+ });
updateSources(["app|foo.txt"]);
expectNoAsset("app|foo.out");
@@ -376,9 +526,13 @@ main() {
test("a lazy transformer that doesn't apply updates its passed-through asset",
() {
- initGraph(["app|foo.txt"], {"app": [
- [new LazyRewriteTransformer("blub", "blab")]
- ]});
+ initGraph([
+ "app|foo.txt"
+ ], {
+ "app": [
+ [new LazyRewriteTransformer("blub", "blab")]
+ ]
+ });
// Pause the provider so that the transformer will start forwarding the
// asset while it's dirty.
@@ -396,11 +550,19 @@ main() {
buildShouldSucceed();
});
- test("a lazy transformer is forced while the previous lazy transformer is "
+ test(
+ "a lazy transformer is forced while the previous lazy transformer is "
"available, then the previous transformer becomes unavailable", () {
var assets = new LazyAssetsTransformer(["app|out.one", "app|out.two"]);
var rewrite = new LazyRewriteTransformer("two", "three");
- initGraph(["app|foo.in"], {"app": [[assets], [rewrite]]});
+ initGraph([
+ "app|foo.in"
+ ], {
+ "app": [
+ [assets],
+ [rewrite]
+ ]
+ });
updateSources(["app|foo.in"]);
// Request out.one so that [assets] runs but the second does not.

Powered by Google App Engine
This is Rietveld 408576698