| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library barback.test.barback_test; |
| 6 |
| 7 import 'package:scheduled_test/scheduled_test.dart'; |
| 8 |
| 9 import '../utils.dart'; |
| 10 |
| 11 main() { |
| 12 initConfig(); |
| 13 |
| 14 test("gets all source assets", () { |
| 15 initGraph(["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"]); |
| 18 buildShouldSucceed(); |
| 19 }); |
| 20 |
| 21 test("includes transformed outputs, but not consumed ones", () { |
| 22 initGraph(["app|a.txt", "app|foo.blub"], {"app": [ |
| 23 [new RewriteTransformer("blub", "blab")] |
| 24 ]}); |
| 25 updateSources(["app|a.txt", "app|foo.blub"]); |
| 26 expectAllAssets(["app|a.txt", "app|foo.blab"]); |
| 27 buildShouldSucceed(); |
| 28 }); |
| 29 |
| 30 test("includes non-primary inputs to transformers", () { |
| 31 var transformer = new ManyToOneTransformer("txt"); |
| 32 initGraph({ |
| 33 "app|a.txt": "a.inc", |
| 34 "app|a.inc": "a" |
| 35 }, {"app": [[transformer]]}); |
| 36 |
| 37 updateSources(["app|a.txt", "app|a.inc"]); |
| 38 expectAllAssets(["app|a.inc", "app|a.out"]); |
| 39 buildShouldSucceed(); |
| 40 }); |
| 41 |
| 42 test("completes to an error if two transformers output the same file", () { |
| 43 initGraph(["app|foo.a"], {"app": [ |
| 44 [ |
| 45 new RewriteTransformer("a", "b"), |
| 46 new RewriteTransformer("a", "b") |
| 47 ] |
| 48 ]}); |
| 49 updateSources(["app|foo.a"]); |
| 50 expectAllAssetsShouldFail(isAssetCollisionException("app|foo.b")); |
| 51 }); |
| 52 |
| 53 test("completes to an error if a transformer fails", () { |
| 54 initGraph(["app|foo.txt"], {"app": [ |
| 55 [new BadTransformer(["app|foo.out"])] |
| 56 ]}); |
| 57 |
| 58 updateSources(["app|foo.txt"]); |
| 59 expectAllAssetsShouldFail(isTransformerException( |
| 60 equals(BadTransformer.ERROR))); |
| 61 }); |
| 62 |
| 63 test("completes to an aggregate error if there are multiple errors", () { |
| 64 initGraph(["app|foo.txt"], {"app": [ |
| 65 [ |
| 66 new BadTransformer(["app|foo.out"]), |
| 67 new BadTransformer(["app|foo.out2"]) |
| 68 ] |
| 69 ]}); |
| 70 |
| 71 updateSources(["app|foo.txt"]); |
| 72 expectAllAssetsShouldFail([ |
| 73 isTransformerException(equals(BadTransformer.ERROR)), |
| 74 isTransformerException(equals(BadTransformer.ERROR)) |
| 75 ]); |
| 76 }); |
| 77 } |
| OLD | NEW |