| 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 // This library contains tests for transformer behavior that relates to actions | 5 // This library contains tests for transformer behavior that relates to actions |
| 6 // happening concurrently or other complex asynchronous timing behavior. | 6 // happening concurrently or other complex asynchronous timing behavior. |
| 7 library barback.test.package_graph.transform.transform_test; | 7 library barback.test.package_graph.transform.transform_test; |
| 8 | 8 |
| 9 import 'package:barback/src/utils.dart'; | 9 import 'package:barback/src/utils.dart'; |
| 10 import 'package:scheduled_test/scheduled_test.dart'; | 10 import 'package:scheduled_test/scheduled_test.dart'; |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 updateSources(['app|foo.txt']); | 334 updateSources(['app|foo.txt']); |
| 335 expectAsset('app|foo.out', 'spread txt.out'); | 335 expectAsset('app|foo.out', 'spread txt.out'); |
| 336 buildShouldSucceed(); | 336 buildShouldSucceed(); |
| 337 | 337 |
| 338 modifyAsset("app|foo.txt", "bar.mid"); | 338 modifyAsset("app|foo.txt", "bar.mid"); |
| 339 updateSources(["app|foo.txt"]); | 339 updateSources(["app|foo.txt"]); |
| 340 expectNoAsset('app|foo.out'); | 340 expectNoAsset('app|foo.out'); |
| 341 expectAsset('app|bar.out', 'spread txt.out'); | 341 expectAsset('app|bar.out', 'spread txt.out'); |
| 342 buildShouldSucceed(); | 342 buildShouldSucceed(); |
| 343 }); | 343 }); |
| 344 |
| 345 group("Transform.hasInput", () { |
| 346 test("returns whether an input exists", () { |
| 347 initGraph(["app|foo.txt", "app|bar.txt"], {'app': [ |
| 348 [new HasInputTransformer(['app|foo.txt', 'app|bar.txt', 'app|baz.txt'])] |
| 349 ]}); |
| 350 |
| 351 updateSources(['app|foo.txt', 'app|bar.txt']); |
| 352 expectAsset('app|foo.txt', |
| 353 'app|foo.txt: true, app|bar.txt: true, app|baz.txt: false'); |
| 354 buildShouldSucceed(); |
| 355 }); |
| 356 |
| 357 test("re-runs the transformer when an input stops existing", () { |
| 358 initGraph(["app|foo.txt", "app|bar.txt"], {'app': [ |
| 359 [new HasInputTransformer(['app|bar.txt'])] |
| 360 ]}); |
| 361 |
| 362 updateSources(['app|foo.txt', 'app|bar.txt']); |
| 363 expectAsset('app|foo.txt', 'app|bar.txt: true'); |
| 364 buildShouldSucceed(); |
| 365 |
| 366 removeSources(['app|bar.txt']); |
| 367 expectAsset('app|foo.txt', 'app|bar.txt: false'); |
| 368 buildShouldSucceed(); |
| 369 }); |
| 370 |
| 371 // TODO(nweiz): enable this when issue 17480 is fixed. |
| 372 // test("re-runs the transformer when an input starts existing", () { |
| 373 // initGraph(["app|foo.txt", "app|bar.txt"], {'app': [ |
| 374 // [new HasInputTransformer(['app|bar.txt'])] |
| 375 // ]}); |
| 376 // |
| 377 // updateSources(['app|foo.txt']); |
| 378 // expectAsset('app|foo.txt', 'app|bar.txt: false'); |
| 379 // buildShouldSucceed(); |
| 380 // |
| 381 // updateSources(['app|bar.txt']); |
| 382 // expectAsset('app|foo.txt', 'app|bar.txt: true'); |
| 383 // buildShouldSucceed(); |
| 384 // }); |
| 385 }); |
| 344 } | 386 } |
| OLD | NEW |