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

Side by Side Diff: pkg/barback/test/package_graph/lazy_transformer_test.dart

Issue 231603005: Preserve laziness in declaring transformers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/barback/lib/src/transform_node.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library barback.test.package_graph.lazy_asset_test; 5 library barback.test.package_graph.lazy_asset_test;
6 6
7 import 'package:barback/barback.dart'; 7 import 'package:barback/barback.dart';
8 import 'package:barback/src/utils.dart'; 8 import 'package:barback/src/utils.dart';
9 import 'package:scheduled_test/scheduled_test.dart'; 9 import 'package:scheduled_test/scheduled_test.dart';
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 var transformer = new LazyRewriteTransformer("blub", "blab"); 75 var transformer = new LazyRewriteTransformer("blub", "blab");
76 initGraph(["app|foo.blub"], {"app": [ 76 initGraph(["app|foo.blub"], {"app": [
77 [transformer], 77 [transformer],
78 [new RewriteTransformer("blab", "blib")] 78 [new RewriteTransformer("blab", "blib")]
79 ]}); 79 ]});
80 updateSources(["app|foo.blub"]); 80 updateSources(["app|foo.blub"]);
81 buildShouldSucceed(); 81 buildShouldSucceed();
82 expect(transformer.numRuns, completion(equals(1))); 82 expect(transformer.numRuns, completion(equals(1)));
83 }); 83 });
84 84
85 // test("a lazy asset piped into a declaring transformer isn't eagerly " 85 test("a lazy asset piped into a declaring transformer isn't eagerly "
86 // "compiled", () { 86 "compiled", () {
87 // var transformer1 = new LazyRewriteTransformer("blub", "blab"); 87 var transformer1 = new LazyRewriteTransformer("blub", "blab");
88 // var transformer2 = new DeclaringRewriteTransformer("blab", "blib"); 88 var transformer2 = new DeclaringRewriteTransformer("blab", "blib");
89 // initGraph(["app|foo.blub"], {"app": [ 89 initGraph(["app|foo.blub"], {"app": [
90 // [transformer1], [transformer2] 90 [transformer1], [transformer2]
91 // ]}); 91 ]});
92 // updateSources(["app|foo.blub"]); 92 updateSources(["app|foo.blub"]);
93 // buildShouldSucceed(); 93 buildShouldSucceed();
94 // expect(transformer1.numRuns, completion(equals(0))); 94 expect(transformer1.numRuns, completion(equals(0)));
95 // expect(transformer2.numRuns, completion(equals(0))); 95 expect(transformer2.numRuns, completion(equals(0)));
96 // }); 96 });
97 // 97
98 // test("a lazy asset piped into a declaring transformer is compiled " 98 test("a lazy asset piped into a declaring transformer is compiled "
99 // "on-demand", () { 99 "on-demand", () {
100 // initGraph(["app|foo.blub"], {"app": [ 100 initGraph(["app|foo.blub"], {"app": [
101 // [new LazyRewriteTransformer("blub", "blab")], 101 [new LazyRewriteTransformer("blub", "blab")],
102 // [new DeclaringRewriteTransformer("blab", "blib")] 102 [new DeclaringRewriteTransformer("blab", "blib")]
103 // ]}); 103 ]});
104 // updateSources(["app|foo.blub"]); 104 updateSources(["app|foo.blub"]);
105 // expectAsset("app|foo.blib", "foo.blab.blib"); 105 expectAsset("app|foo.blib", "foo.blab.blib");
106 // buildShouldSucceed(); 106 buildShouldSucceed();
107 // }); 107 });
108
109 test("a lazy asset piped through many declaring transformers isn't eagerly "
110 "compiled", () {
111 var transformer1 = new LazyRewriteTransformer("one", "two");
112 var transformer2 = new DeclaringRewriteTransformer("two", "three");
113 var transformer3 = new DeclaringRewriteTransformer("three", "four");
114 var transformer4 = new DeclaringRewriteTransformer("four", "five");
115 initGraph(["app|foo.one"], {"app": [
116 [transformer1], [transformer2], [transformer3], [transformer4]
117 ]});
118 updateSources(["app|foo.one"]);
119 buildShouldSucceed();
120 expect(transformer1.numRuns, completion(equals(0)));
121 expect(transformer2.numRuns, completion(equals(0)));
122 expect(transformer3.numRuns, completion(equals(0)));
123 expect(transformer4.numRuns, completion(equals(0)));
124 });
125
126 test("a lazy asset piped through many declaring transformers is compiled "
127 "on-demand", () {
128 initGraph(["app|foo.one"], {"app": [
129 [new LazyRewriteTransformer("one", "two")],
130 [new DeclaringRewriteTransformer("two", "three")],
131 [new DeclaringRewriteTransformer("three", "four")],
132 [new DeclaringRewriteTransformer("four", "five")]
133 ]});
134 updateSources(["app|foo.one"]);
135 expectAsset("app|foo.five", "foo.two.three.four.five");
136 buildShouldSucceed();
137 });
108 138
109 test("a lazy asset works as a cross-package input", () { 139 test("a lazy asset works as a cross-package input", () {
110 initGraph({ 140 initGraph({
111 "pkg1|foo.blub": "foo", 141 "pkg1|foo.blub": "foo",
112 "pkg2|a.txt": "pkg1|foo.blab" 142 "pkg2|a.txt": "pkg1|foo.blab"
113 }, {"pkg1": [ 143 }, {"pkg1": [
114 [new LazyRewriteTransformer("blub", "blab")], 144 [new LazyRewriteTransformer("blub", "blab")],
115 ], "pkg2": [ 145 ], "pkg2": [
116 [new ManyToOneTransformer("txt")] 146 [new ManyToOneTransformer("txt")]
117 ]}); 147 ]});
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 resumeProvider(); 273 resumeProvider();
244 expectAsset("app|foo.txt", "foo"); 274 expectAsset("app|foo.txt", "foo");
245 buildShouldSucceed(); 275 buildShouldSucceed();
246 276
247 modifyAsset("app|foo.txt", "bar"); 277 modifyAsset("app|foo.txt", "bar");
248 updateSources(["app|foo.txt"]); 278 updateSources(["app|foo.txt"]);
249 expectAsset("app|foo.txt", "bar"); 279 expectAsset("app|foo.txt", "bar");
250 buildShouldSucceed(); 280 buildShouldSucceed();
251 }); 281 });
252 } 282 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/transform_node.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698