| 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.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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 [new LazyRewriteTransformer("one", "two")], | 129 [new LazyRewriteTransformer("one", "two")], |
| 130 [new DeclaringRewriteTransformer("two", "three")], | 130 [new DeclaringRewriteTransformer("two", "three")], |
| 131 [new DeclaringRewriteTransformer("three", "four")], | 131 [new DeclaringRewriteTransformer("three", "four")], |
| 132 [new DeclaringRewriteTransformer("four", "five")] | 132 [new DeclaringRewriteTransformer("four", "five")] |
| 133 ]}); | 133 ]}); |
| 134 updateSources(["app|foo.one"]); | 134 updateSources(["app|foo.one"]); |
| 135 expectAsset("app|foo.five", "foo.two.three.four.five"); | 135 expectAsset("app|foo.five", "foo.two.three.four.five"); |
| 136 buildShouldSucceed(); | 136 buildShouldSucceed(); |
| 137 }); | 137 }); |
| 138 | 138 |
| 139 test("a lazy asset piped into a non-lazy transformer that doesn't use its " |
| 140 "outputs isn't eagerly compiled", () { |
| 141 var transformer = new LazyRewriteTransformer("blub", "blab"); |
| 142 initGraph(["app|foo.blub"], {"app": [ |
| 143 [transformer], |
| 144 [new RewriteTransformer("txt", "out")] |
| 145 ]}); |
| 146 updateSources(["app|foo.blub"]); |
| 147 buildShouldSucceed(); |
| 148 expect(transformer.numRuns, completion(equals(0))); |
| 149 }); |
| 150 |
| 151 test("a lazy asset piped into a non-lazy transformer that doesn't use its " |
| 152 "outputs is compiled on-demand", () { |
| 153 initGraph(["app|foo.blub"], {"app": [ |
| 154 [new LazyRewriteTransformer("blub", "blab")], |
| 155 [new RewriteTransformer("txt", "out")] |
| 156 ]}); |
| 157 updateSources(["app|foo.blub"]); |
| 158 expectAsset("app|foo.blab", "foo.blab"); |
| 159 buildShouldSucceed(); |
| 160 }); |
| 161 |
| 139 test("a lazy transformer followed by a non-lazy transformer is re-run " | 162 test("a lazy transformer followed by a non-lazy transformer is re-run " |
| 140 "eagerly", () { | 163 "eagerly", () { |
| 141 var rewrite = new LazyRewriteTransformer("one", "two"); | 164 var rewrite = new LazyRewriteTransformer("one", "two"); |
| 142 initGraph(["app|foo.one"], {"app": [ | 165 initGraph(["app|foo.one"], {"app": [ |
| 143 [rewrite], | 166 [rewrite], |
| 144 [new RewriteTransformer("two", "three")] | 167 [new RewriteTransformer("two", "three")] |
| 145 ]}); | 168 ]}); |
| 146 | 169 |
| 147 updateSources(["app|foo.one"]); | 170 updateSources(["app|foo.one"]); |
| 148 expectAsset("app|foo.three", "foo.two.three"); | 171 expectAsset("app|foo.three", "foo.two.three"); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 resumeProvider(); | 370 resumeProvider(); |
| 348 expectAsset("app|foo.txt", "foo"); | 371 expectAsset("app|foo.txt", "foo"); |
| 349 buildShouldSucceed(); | 372 buildShouldSucceed(); |
| 350 | 373 |
| 351 modifyAsset("app|foo.txt", "bar"); | 374 modifyAsset("app|foo.txt", "bar"); |
| 352 updateSources(["app|foo.txt"]); | 375 updateSources(["app|foo.txt"]); |
| 353 expectAsset("app|foo.txt", "bar"); | 376 expectAsset("app|foo.txt", "bar"); |
| 354 buildShouldSucceed(); | 377 buildShouldSucceed(); |
| 355 }); | 378 }); |
| 356 } | 379 } |
| OLD | NEW |