| 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.static_provider_test; | 5 library barback.test.static_provider_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 test("gets a static source asset", () { | 13 test("gets a static source asset", () { |
| 14 initStaticGraph(["app|foo.txt"], staticPackages: ["app"]); | 14 initStaticGraph(["app|foo.txt"], staticPackages: ["app"]); |
| 15 expectAsset("app|foo.txt"); | 15 expectAsset("app|foo.txt"); |
| 16 buildShouldSucceed(); | 16 buildShouldSucceed(); |
| 17 }); | 17 }); |
| 18 | 18 |
| 19 test("doesn't get a nonexistent static source asset", () { | 19 test("doesn't get a nonexistent static source asset", () { |
| 20 initStaticGraph(["app|foo.txt"], staticPackages: ["app"]); | 20 initStaticGraph(["app|foo.txt"], staticPackages: ["app"]); |
| 21 expectNoAsset("app|bar.txt"); | 21 expectNoAsset("app|bar.txt"); |
| 22 }); | 22 }); |
| 23 | 23 |
| 24 test("a transformer can see a static asset", () { | 24 test("a transformer can see a static asset", () { |
| 25 initStaticGraph({ | 25 initStaticGraph({ |
| 26 "static|b.inc": "b", | 26 "static|b.inc": "b", |
| 27 "app|a.txt": "static|b.inc" | 27 "app|a.txt": "static|b.inc" |
| 28 }, staticPackages: ["static"], transformers: { | 28 }, staticPackages: [ |
| 29 "app": [[new ManyToOneTransformer("txt")]] | 29 "static" |
| 30 ], transformers: { |
| 31 "app": [ |
| 32 [new ManyToOneTransformer("txt")] |
| 33 ] |
| 30 }); | 34 }); |
| 31 updateSources(["app|a.txt"]); | 35 updateSources(["app|a.txt"]); |
| 32 expectAsset("app|a.out", "b"); | 36 expectAsset("app|a.out", "b"); |
| 33 }); | 37 }); |
| 34 | 38 |
| 35 test("can list all static assets", () { | 39 test("can list all static assets", () { |
| 36 initStaticGraph(["app|foo.txt", "app|bar.txt", "app|baz.txt"], | 40 initStaticGraph(["app|foo.txt", "app|bar.txt", "app|baz.txt"], |
| 37 staticPackages: ["app"]); | 41 staticPackages: ["app"]); |
| 38 expectAllAssets(["app|foo.txt", "app|bar.txt", "app|baz.txt"]); | 42 expectAllAssets(["app|foo.txt", "app|bar.txt", "app|baz.txt"]); |
| 39 }); | 43 }); |
| 40 } | 44 } |
| OLD | NEW |