| 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.barback_test; | 5 library barback.test.barback_test; |
| 6 | 6 |
| 7 import 'package:scheduled_test/scheduled_test.dart'; | 7 import 'package:scheduled_test/scheduled_test.dart'; |
| 8 | 8 |
| 9 import '../utils.dart'; | 9 import '../utils.dart'; |
| 10 | 10 |
| 11 main() { | 11 main() { |
| 12 initConfig(); | 12 initConfig(); |
| 13 | 13 |
| 14 test("gets all source assets", () { | 14 test("gets all source assets", () { |
| 15 initGraph(["app|a.txt", "app|b.txt", "app|c.txt"]); | 15 initGraph(["app|a.txt", "app|b.txt", "app|c.txt"]); |
| 16 updateSources(["app|a.txt", "app|b.txt", "app|c.txt"]); | 16 updateSources(["app|a.txt", "app|b.txt", "app|c.txt"]); |
| 17 expectAllAssets(["app|a.txt", "app|b.txt", "app|c.txt"]); | 17 expectAllAssets(["app|a.txt", "app|b.txt", "app|c.txt"]); |
| 18 buildShouldSucceed(); | 18 buildShouldSucceed(); |
| 19 }); | 19 }); |
| 20 | 20 |
| 21 test("includes transformed outputs", () { | 21 test("includes transformed outputs, but not consumed ones", () { |
| 22 initGraph(["app|a.txt", "app|foo.blub"], {"app": [ | 22 initGraph(["app|a.txt", "app|foo.blub"], {"app": [ |
| 23 [new RewriteTransformer("blub", "blab")] | 23 [new RewriteTransformer("blub", "blab")] |
| 24 ]}); | 24 ]}); |
| 25 updateSources(["app|a.txt", "app|foo.blub"]); | 25 updateSources(["app|a.txt", "app|foo.blub"]); |
| 26 expectAllAssets(["app|a.txt", "app|foo.blub", "app|foo.blab"]); | 26 expectAllAssets(["app|a.txt", "app|foo.blab"]); |
| 27 buildShouldSucceed(); | 27 buildShouldSucceed(); |
| 28 }); | 28 }); |
| 29 | 29 |
| 30 test("includes overwritten outputs", () { | 30 test("includes non-primary inputs to transformers", () { |
| 31 initGraph(["app|a.txt", "app|foo.blub"], {"app": [ | 31 var transformer = new ManyToOneTransformer("txt"); |
| 32 [new RewriteTransformer("blub", "blub")] | 32 initGraph({ |
| 33 ]}); | 33 "app|a.txt": "a.inc", |
| 34 updateSources(["app|a.txt", "app|foo.blub"]); | 34 "app|a.inc": "a" |
| 35 expectAllAssets({ | 35 }, {"app": [[transformer]]}); |
| 36 "app|a.txt": "a", | 36 |
| 37 "app|foo.blub": "foo.blub" | 37 updateSources(["app|a.txt", "app|a.inc"]); |
| 38 }); | 38 expectAllAssets(["app|a.inc", "app|a.out"]); |
| 39 buildShouldSucceed(); | 39 buildShouldSucceed(); |
| 40 }); | 40 }); |
| 41 | 41 |
| 42 test("completes to an error if two transformers output the same file", () { | 42 test("completes to an error if two transformers output the same file", () { |
| 43 initGraph(["app|foo.a"], {"app": [ | 43 initGraph(["app|foo.a"], {"app": [ |
| 44 [ | 44 [ |
| 45 new RewriteTransformer("a", "b"), | 45 new RewriteTransformer("a", "b"), |
| 46 new RewriteTransformer("a", "b") | 46 new RewriteTransformer("a", "b") |
| 47 ] | 47 ] |
| 48 ]}); | 48 ]}); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 68 ] | 68 ] |
| 69 ]}); | 69 ]}); |
| 70 | 70 |
| 71 updateSources(["app|foo.txt"]); | 71 updateSources(["app|foo.txt"]); |
| 72 expectAllAssetsShouldFail(isAggregateException([ | 72 expectAllAssetsShouldFail(isAggregateException([ |
| 73 isTransformerException(equals(BadTransformer.ERROR)), | 73 isTransformerException(equals(BadTransformer.ERROR)), |
| 74 isTransformerException(equals(BadTransformer.ERROR)) | 74 isTransformerException(equals(BadTransformer.ERROR)) |
| 75 ])); | 75 ])); |
| 76 }); | 76 }); |
| 77 } | 77 } |
| OLD | NEW |