| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.transform_test; | 5 library barback.test.package_graph.transform_test; |
| 6 | 6 |
| 7 import 'package:barback/src/utils.dart'; | 7 import 'package:barback/src/utils.dart'; |
| 8 import 'package:scheduled_test/scheduled_test.dart'; | 8 import 'package:scheduled_test/scheduled_test.dart'; |
| 9 | 9 |
| 10 import '../utils.dart'; | 10 import '../utils.dart'; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // Ensure we're waiting on [rewrite.apply]. | 167 // Ensure we're waiting on [rewrite.apply]. |
| 168 schedule(pumpEventQueue); | 168 schedule(pumpEventQueue); |
| 169 | 169 |
| 170 updateTransformers("app", []); | 170 updateTransformers("app", []); |
| 171 rewrite.resumeApply(); | 171 rewrite.resumeApply(); |
| 172 expectAsset("app|foo.blub", "foo"); | 172 expectAsset("app|foo.blub", "foo"); |
| 173 expectNoAsset("app|foo.blab"); | 173 expectNoAsset("app|foo.blab"); |
| 174 buildShouldSucceed(); | 174 buildShouldSucceed(); |
| 175 }); | 175 }); |
| 176 | 176 |
| 177 test("a transformer is added to an existing phase during isPrimary", () { |
| 178 var rewrite = new RewriteTransformer("blub", "blab"); |
| 179 initGraph(["app|foo.blub", "app|bar.blib"], {"app": [[rewrite]]}); |
| 180 |
| 181 rewrite.pauseIsPrimary("app|foo.blub"); |
| 182 updateSources(["app|foo.blub", "app|bar.blib"]); |
| 183 // Ensure we're waiting on [rewrite.isPrimary]. |
| 184 schedule(pumpEventQueue); |
| 185 |
| 186 updateTransformers("app", [ |
| 187 [rewrite, new RewriteTransformer("blib", "blob")] |
| 188 ]); |
| 189 rewrite.resumeIsPrimary("app|foo.blub"); |
| 190 expectAsset("app|foo.blab", "foo.blab"); |
| 191 expectAsset("app|bar.blob", "bar.blob"); |
| 192 buildShouldSucceed(); |
| 193 }); |
| 194 |
| 177 test("a new transformer can see pass-through assets", () { | 195 test("a new transformer can see pass-through assets", () { |
| 178 var rewrite = new RewriteTransformer("zip", "zap"); | 196 var rewrite = new RewriteTransformer("zip", "zap"); |
| 179 initGraph(["app|foo.blub"], {"app": [[rewrite]]}); | 197 initGraph(["app|foo.blub"], {"app": [[rewrite]]}); |
| 180 | 198 |
| 181 updateSources(["app|foo.blub"]); | 199 updateSources(["app|foo.blub"]); |
| 182 buildShouldSucceed(); | 200 buildShouldSucceed(); |
| 183 | 201 |
| 184 updateTransformers("app", [ | 202 updateTransformers("app", [ |
| 185 [rewrite], | 203 [rewrite], |
| 186 [new RewriteTransformer("blub", "blab")] | 204 [new RewriteTransformer("blub", "blab")] |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 246 |
| 229 updateSources(["pkg1|foo.txt", "pkg2|foo.inc"]); | 247 updateSources(["pkg1|foo.txt", "pkg2|foo.inc"]); |
| 230 expectAsset("pkg1|foo.out", "foo.inc.inc"); | 248 expectAsset("pkg1|foo.out", "foo.inc.inc"); |
| 231 buildShouldSucceed(); | 249 buildShouldSucceed(); |
| 232 | 250 |
| 233 updateTransformers("pkg2", [[rewrite]]); | 251 updateTransformers("pkg2", [[rewrite]]); |
| 234 expectAsset("pkg1|foo.out", "foo.inc"); | 252 expectAsset("pkg1|foo.out", "foo.inc"); |
| 235 buildShouldSucceed(); | 253 buildShouldSucceed(); |
| 236 }); | 254 }); |
| 237 } | 255 } |
| OLD | NEW |