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

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

Issue 22265002: Support cross-package transforms in barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove a duplicated test. Created 7 years, 4 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_test.dart
diff --git a/pkg/barback/test/package_graph/transform_test.dart b/pkg/barback/test/package_graph/transform_test.dart
index 670848a50d81358d6e4bce2c0eb814e27279f322..a4631838f27a28134c67af043c8dd0b4fd0b4a6b 100644
--- a/pkg/barback/test/package_graph/transform_test.dart
+++ b/pkg/barback/test/package_graph/transform_test.dart
@@ -894,4 +894,118 @@ main() {
resumeProvider();
buildShouldSucceed();
});
+
+ group('cross-package transforms', () {
+ test("can access other packages' source assets", () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.inc": "a"
+ }, {"pkg1": [[new ManyToOneTransformer("txt")]]});
+
+ updateSources(["pkg1|a.txt", "pkg2|a.inc"]);
+ expectAsset("pkg1|a.out", "a");
+ buildShouldSucceed();
+ });
+
+ test("can access other packages' transformed assets", () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.txt": "a"
+ }, {
+ "pkg1": [[new ManyToOneTransformer("txt")]],
+ "pkg2": [[new RewriteTransformer("txt", "inc")]]
+ });
+
+ updateSources(["pkg1|a.txt", "pkg2|a.txt"]);
+ expectAsset("pkg1|a.out", "a.inc");
+ buildShouldSucceed();
+ });
+
+ test("re-runs a transform when an input from another package changes", () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.inc": "a"
+ }, {
+ "pkg1": [[new ManyToOneTransformer("txt")]]
+ });
+
+ updateSources(["pkg1|a.txt", "pkg2|a.inc"]);
+ expectAsset("pkg1|a.out", "a");
+ buildShouldSucceed();
+
+ modifyAsset("pkg2|a.inc", "new a");
+ schedule(() => updateSources(["pkg2|a.inc"]));
+ expectAsset("pkg1|a.out", "new a");
+ buildShouldSucceed();
+ });
+
+ test("re-runs a transform when a transformed input from another package "
+ "changes", () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.txt": "a"
+ }, {
+ "pkg1": [[new ManyToOneTransformer("txt")]],
+ "pkg2": [[new RewriteTransformer("txt", "inc")]]
+ });
+
+ updateSources(["pkg1|a.txt", "pkg2|a.txt"]);
+ expectAsset("pkg1|a.out", "a.inc");
+ buildShouldSucceed();
+
+ modifyAsset("pkg2|a.txt", "new a");
+ schedule(() => updateSources(["pkg2|a.txt"]));
+ expectAsset("pkg1|a.out", "new a.inc");
+ buildShouldSucceed();
+ });
+
+ test("runs a transform that's added because of a change in another package",
+ () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.inc": "b"
+ }, {
+ "pkg1": [
+ [new ManyToOneTransformer("txt")],
+ [new OneToManyTransformer("out")],
+ [new RewriteTransformer("md", "done")]
+ ],
+ });
+
Bob Nystrom 2013/08/07 22:00:08 This one is particularly hard to follow. How about
nweiz 2013/08/07 22:59:15 Done.
+ updateSources(["pkg1|a.txt", "pkg2|a.inc"]);
+ expectAsset("pkg1|b", "spread out");
+ buildShouldSucceed();
+
+ modifyAsset("pkg2|a.inc", "b,c.md");
+ schedule(() => updateSources(["pkg2|a.inc"]));
+ expectAsset("pkg1|b", "spread out");
+ expectAsset("pkg1|c.done", "spread out.done");
+ buildShouldSucceed();
+ });
+
+ test("doesn't run a transform that's removed because of a change in "
+ "another package", () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.inc": "b,c.md"
+ }, {
+ "pkg1": [
+ [new ManyToOneTransformer("txt")],
+ [new OneToManyTransformer("out")],
+ [new RewriteTransformer("md", "done")]
+ ],
+ });
+
+ updateSources(["pkg1|a.txt", "pkg2|a.inc"]);
+ expectAsset("pkg1|b", "spread out");
+ expectAsset("pkg1|c.done", "spread out.done");
+ buildShouldSucceed();
+
+ modifyAsset("pkg2|a.inc", "b");
+ schedule(() => updateSources(["pkg2|a.inc"]));
+ expectAsset("pkg1|b", "spread out");
+ expectNoAsset("pkg1|c.done");
+ buildShouldSucceed();
+ });
+ });
}

Powered by Google App Engine
This is Rietveld 408576698