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

Unified Diff: pkg/barback/test/package_graph/transform/transform_test.dart

Issue 196983015: Add a [Transform.hasInput] convenience method to Barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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: pkg/barback/test/package_graph/transform/transform_test.dart
diff --git a/pkg/barback/test/package_graph/transform/transform_test.dart b/pkg/barback/test/package_graph/transform/transform_test.dart
index 747512c723801f47c8d4c78e38253b3e7edbf521..8cc9085cc274661b5459f920c2d2de7f6a458ff8 100644
--- a/pkg/barback/test/package_graph/transform/transform_test.dart
+++ b/pkg/barback/test/package_graph/transform/transform_test.dart
@@ -341,4 +341,46 @@ main() {
expectAsset('app|bar.out', 'spread txt.out');
buildShouldSucceed();
});
+
+ group("Transform.hasInput", () {
+ test("returns whether an input exists", () {
+ initGraph(["app|foo.txt", "app|bar.txt"], {'app': [
+ [new HasInputTransformer(['app|foo.txt', 'app|bar.txt', 'app|baz.txt'])]
+ ]});
+
+ updateSources(['app|foo.txt', 'app|bar.txt']);
+ expectAsset('app|foo.txt',
+ 'app|foo.txt: true, app|bar.txt: true, app|baz.txt: false');
+ buildShouldSucceed();
+ });
+
+ test("re-runs the transformer when an input stops existing", () {
+ initGraph(["app|foo.txt", "app|bar.txt"], {'app': [
+ [new HasInputTransformer(['app|bar.txt'])]
+ ]});
+
+ updateSources(['app|foo.txt', 'app|bar.txt']);
+ expectAsset('app|foo.txt', 'app|bar.txt: true');
+ buildShouldSucceed();
+
+ removeSources(['app|bar.txt']);
+ expectAsset('app|foo.txt', 'app|bar.txt: false');
+ buildShouldSucceed();
+ });
+
+ // TODO(nweiz): enable this when issue 17480 is fixed.
+ // test("re-runs the transformer when an input starts existing", () {
+ // initGraph(["app|foo.txt", "app|bar.txt"], {'app': [
+ // [new HasInputTransformer(['app|bar.txt'])]
+ // ]});
+ //
+ // updateSources(['app|foo.txt']);
+ // expectAsset('app|foo.txt', 'app|bar.txt: false');
+ // buildShouldSucceed();
+ //
+ // updateSources(['app|bar.txt']);
+ // expectAsset('app|foo.txt', 'app|bar.txt: true');
+ // buildShouldSucceed();
+ // });
+ });
}

Powered by Google App Engine
This is Rietveld 408576698