OLD | NEW |
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.declaring_transformer_test; | 5 library barback.test.package_graph.declaring_transformer_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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 transformer.pauseApply(); | 159 transformer.pauseApply(); |
160 updateSources(["app|foo.blub"]); | 160 updateSources(["app|foo.blub"]); |
161 expectAssetDoesNotComplete("app|foo.blub"); | 161 expectAssetDoesNotComplete("app|foo.blub"); |
162 | 162 |
163 transformer.resumeApply(); | 163 transformer.resumeApply(); |
164 expectAsset("app|foo.blub", "foo.blub"); | 164 expectAsset("app|foo.blub", "foo.blub"); |
165 buildShouldSucceed(); | 165 buildShouldSucceed(); |
166 }); | 166 }); |
167 | 167 |
| 168 // Regression test for #64. |
| 169 test("a declaring transformer's output passes through a lazy transformer", |
| 170 () { |
| 171 var declaring = new DeclaringRewriteTransformer("one", "two"); |
| 172 initGraph(["app|foo.one"], {"app": [ |
| 173 [declaring], |
| 174 [new LazyRewriteTransformer("two", "three")] |
| 175 ]}); |
| 176 |
| 177 updateSources(["app|foo.one"]); |
| 178 // Give the transformers time to declare their assets. |
| 179 schedule(pumpEventQueue); |
| 180 |
| 181 expectAsset("app|foo.one", "foo"); |
| 182 expectAsset("app|foo.two", "foo.two"); |
| 183 expectAsset("app|foo.three", "foo.two.three"); |
| 184 buildShouldSucceed(); |
| 185 |
| 186 modifyAsset("app|foo.one", "bar"); |
| 187 updateSources(["app|foo.one"]); |
| 188 |
| 189 expectAsset("app|foo.one", "bar"); |
| 190 expectAsset("app|foo.two", "bar.two"); |
| 191 expectAsset("app|foo.three", "bar.two.three"); |
| 192 buildShouldSucceed(); |
| 193 |
| 194 expect(declaring.numRuns, completion(equals(2))); |
| 195 }); |
| 196 |
168 test("a declaring transformer following a lazy transformer runs eagerly once " | 197 test("a declaring transformer following a lazy transformer runs eagerly once " |
169 "its input is available", () { | 198 "its input is available", () { |
170 var declaring = new DeclaringRewriteTransformer("two", "three"); | 199 var declaring = new DeclaringRewriteTransformer("two", "three"); |
171 initGraph(["app|foo.in"], {"app": [ | 200 initGraph(["app|foo.in"], {"app": [ |
172 [new LazyAssetsTransformer(["app|out.one", "app|out.two"])], | 201 [new LazyAssetsTransformer(["app|out.one", "app|out.two"])], |
173 [declaring] | 202 [declaring] |
174 ]}); | 203 ]}); |
175 | 204 |
176 updateSources(["app|foo.in"]); | 205 updateSources(["app|foo.in"]); |
177 // Give the transformers time to declare their assets. | 206 // Give the transformers time to declare their assets. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 test("can declare outputs it doesn't emit", () { | 362 test("can declare outputs it doesn't emit", () { |
334 initGraph(["app|foo.txt"], {"app": [ | 363 initGraph(["app|foo.txt"], {"app": [ |
335 [new DeclareAssetsTransformer(["app|out.txt"], emitted: [])] | 364 [new DeclareAssetsTransformer(["app|out.txt"], emitted: [])] |
336 ]}); | 365 ]}); |
337 | 366 |
338 updateSources(["app|foo.txt"]); | 367 updateSources(["app|foo.txt"]); |
339 expectNoAsset("app|out.txt"); | 368 expectNoAsset("app|out.txt"); |
340 buildShouldSucceed(); | 369 buildShouldSucceed(); |
341 }); | 370 }); |
342 } | 371 } |
OLD | NEW |