| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 ]]}); | 296 ]]}); |
| 297 | 297 |
| 298 updateSources(["app|foo.txt"]); | 298 updateSources(["app|foo.txt"]); |
| 299 expectNoAsset("app|out.txt"); | 299 expectNoAsset("app|out.txt"); |
| 300 expectAsset("app|foo.txt", "foo"); | 300 expectAsset("app|foo.txt", "foo"); |
| 301 buildShouldFail([isTransformerException(BadTransformer.ERROR)]); | 301 buildShouldFail([isTransformerException(BadTransformer.ERROR)]); |
| 302 }); | 302 }); |
| 303 | 303 |
| 304 test("can emit outputs it didn't declare", () { | 304 test("can emit outputs it didn't declare", () { |
| 305 initGraph(["app|foo.txt"], {"app": [ | 305 initGraph(["app|foo.txt"], {"app": [ |
| 306 [new DeclareAssetsTransformer([], ["app|out.txt"])] | 306 [new DeclareAssetsTransformer([], emitted: ["app|out.txt"])] |
| 307 ]}); | 307 ]}); |
| 308 | 308 |
| 309 updateSources(["app|foo.txt"]); | 309 updateSources(["app|foo.txt"]); |
| 310 // There's probably going to be some time when "out.txt" is unavailable, | 310 // There's probably going to be some time when "out.txt" is unavailable, |
| 311 // since it was undeclared. | 311 // since it was undeclared. |
| 312 schedule(pumpEventQueue); | 312 schedule(pumpEventQueue); |
| 313 expectAsset("app|out.txt", "app|out.txt"); | 313 expectAsset("app|out.txt", "app|out.txt"); |
| 314 buildShouldSucceed(); | 314 buildShouldSucceed(); |
| 315 }); | 315 }); |
| 316 | 316 |
| 317 test("can overwrite the primary input even if it declared that it wouldn't", | 317 test("can overwrite the primary input even if it declared that it wouldn't", |
| 318 () { | 318 () { |
| 319 var transformer = new DeclareAssetsTransformer([], ["app|foo.txt"]); | 319 var transformer = new DeclareAssetsTransformer( |
| 320 [], emitted: ["app|foo.txt"]); |
| 320 initGraph(["app|foo.txt"], {"app": [[transformer]]}); | 321 initGraph(["app|foo.txt"], {"app": [[transformer]]}); |
| 321 | 322 |
| 322 transformer.pauseApply(); | 323 transformer.pauseApply(); |
| 323 updateSources(["app|foo.txt"]); | 324 updateSources(["app|foo.txt"]); |
| 324 expectAsset("app|foo.txt", "foo"); | 325 expectAsset("app|foo.txt", "foo"); |
| 325 | 326 |
| 326 transformer.resumeApply(); | 327 transformer.resumeApply(); |
| 327 schedule(pumpEventQueue); | 328 schedule(pumpEventQueue); |
| 328 expectAsset("app|foo.txt", "app|foo.txt"); | 329 expectAsset("app|foo.txt", "app|foo.txt"); |
| 329 buildShouldSucceed(); | 330 buildShouldSucceed(); |
| 330 }); | 331 }); |
| 331 | 332 |
| 332 test("can declare outputs it doesn't emit", () { | 333 test("can declare outputs it doesn't emit", () { |
| 333 initGraph(["app|foo.txt"], {"app": [ | 334 initGraph(["app|foo.txt"], {"app": [ |
| 334 [new DeclareAssetsTransformer(["app|out.txt"], [])] | 335 [new DeclareAssetsTransformer(["app|out.txt"], emitted: [])] |
| 335 ]}); | 336 ]}); |
| 336 | 337 |
| 337 updateSources(["app|foo.txt"]); | 338 updateSources(["app|foo.txt"]); |
| 338 expectNoAsset("app|out.txt"); | 339 expectNoAsset("app|out.txt"); |
| 339 buildShouldSucceed(); | 340 buildShouldSucceed(); |
| 340 }); | 341 }); |
| 341 } | 342 } |
| OLD | NEW |