| 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.package_graph.source_test; | 5 library barback.test.package_graph.source_test; |
| 6 | 6 |
| 7 import 'package:barback/src/utils.dart'; | 7 import 'package:barback/src/utils.dart'; |
| 8 import 'package:scheduled_test/scheduled_test.dart'; | 8 import 'package:scheduled_test/scheduled_test.dart'; |
| 9 | 9 |
| 10 import '../utils.dart'; | 10 import '../utils.dart'; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 expectNoAsset("app|foo.txt"); | 49 expectNoAsset("app|foo.txt"); |
| 50 buildShouldSucceed(); | 50 buildShouldSucceed(); |
| 51 }); | 51 }); |
| 52 | 52 |
| 53 test("reports an error for an unprovided package", () { | 53 test("reports an error for an unprovided package", () { |
| 54 initGraph(); | 54 initGraph(); |
| 55 expect(() => updateSourcesSync(["unknown|foo.txt"]), throwsArgumentError); | 55 expect(() => updateSourcesSync(["unknown|foo.txt"]), throwsArgumentError); |
| 56 }); | 56 }); |
| 57 | 57 |
| 58 test("reports an error for an unprovided source", () { | 58 test("reports an error for an unprovided source", () { |
| 59 initGraph(["app|known.txt"]); | 59 initGraph(["app|known.txt"], {"app": [ |
| 60 // Have a dummy transformer so that barback at least tries to load the |
| 61 // asset. |
| 62 [new RewriteTransformer("a", "b")] |
| 63 ]}); |
| 64 |
| 60 updateSources(["app|unknown.txt"]); | 65 updateSources(["app|unknown.txt"]); |
| 61 | 66 |
| 62 buildShouldFail([ | 67 buildShouldFail([ |
| 63 isAssetLoadException("app|unknown.txt", | 68 isAssetLoadException("app|unknown.txt", |
| 64 isAssetNotFoundException("app|unknown.txt")) | 69 isAssetNotFoundException("app|unknown.txt")) |
| 65 ]); | 70 ]); |
| 66 }); | 71 }); |
| 67 | 72 |
| 68 test("reports missing input errors in results", () { | 73 test("reports missing input errors in results", () { |
| 69 initGraph({"app|a.txt": "a.inc"}, {"app": [ | 74 initGraph({"app|a.txt": "a.inc"}, {"app": [ |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 }); | 152 }); |
| 148 | 153 |
| 149 updateSources(["pkg1|foo.txt", "pkg2|foo.txt"]); | 154 updateSources(["pkg1|foo.txt", "pkg2|foo.txt"]); |
| 150 buildShouldFail([ | 155 buildShouldFail([ |
| 151 isTransformerException(equals(BadTransformer.ERROR)), | 156 isTransformerException(equals(BadTransformer.ERROR)), |
| 152 isTransformerException(equals(BadTransformer.ERROR)) | 157 isTransformerException(equals(BadTransformer.ERROR)) |
| 153 ]); | 158 ]); |
| 154 }); | 159 }); |
| 155 | 160 |
| 156 test("an error loading an asset removes the asset from the graph", () { | 161 test("an error loading an asset removes the asset from the graph", () { |
| 157 initGraph(["app|foo.txt"]); | 162 initGraph(["app|foo.txt"], {"app": [ |
| 163 // Have a dummy transformer so that barback at least tries to load the |
| 164 // asset. |
| 165 [new RewriteTransformer("a", "b")] |
| 166 ]}); |
| 158 | 167 |
| 159 setAssetError("app|foo.txt"); | 168 setAssetError("app|foo.txt"); |
| 160 updateSources(["app|foo.txt"]); | 169 updateSources(["app|foo.txt"]); |
| 161 expectNoAsset("app|foo.txt"); | 170 expectNoAsset("app|foo.txt"); |
| 162 buildShouldFail([ | 171 buildShouldFail([ |
| 163 isAssetLoadException("app|foo.txt", isMockLoadException("app|foo.txt")) | 172 isAssetLoadException("app|foo.txt", isMockLoadException("app|foo.txt")) |
| 164 ]); | 173 ]); |
| 165 }); | 174 }); |
| 166 | 175 |
| 167 test("a collision returns the first-produced output", () { | 176 test("a collision returns the first-produced output", () { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 327 |
| 319 updateSources(["app|foo.txt"]); | 328 updateSources(["app|foo.txt"]); |
| 320 expectAsset("app|foo.txt", "foo"); | 329 expectAsset("app|foo.txt", "foo"); |
| 321 buildShouldSucceed(); | 330 buildShouldSucceed(); |
| 322 | 331 |
| 323 updateSources(["app|foo.in"]); | 332 updateSources(["app|foo.in"]); |
| 324 expectAsset("app|foo.txt", "foo"); | 333 expectAsset("app|foo.txt", "foo"); |
| 325 buildShouldFail([isAssetCollisionException("app|foo.txt")]); | 334 buildShouldFail([isAssetCollisionException("app|foo.txt")]); |
| 326 }); | 335 }); |
| 327 } | 336 } |
| OLD | NEW |