| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 ]}); | 138 ]}); |
| 139 | 139 |
| 140 setAssetError("app|foo.txt"); | 140 setAssetError("app|foo.txt"); |
| 141 updateSources(["app|foo.txt"]); | 141 updateSources(["app|foo.txt"]); |
| 142 expectNoAsset("app|foo.txt"); | 142 expectNoAsset("app|foo.txt"); |
| 143 buildShouldFail([ | 143 buildShouldFail([ |
| 144 isAssetLoadException("app|foo.txt", isMockLoadException("app|foo.txt")) | 144 isAssetLoadException("app|foo.txt", isMockLoadException("app|foo.txt")) |
| 145 ]); | 145 ]); |
| 146 }); | 146 }); |
| 147 | 147 |
| 148 test("a synchronous error loading an asset removes the asset from the graph", |
| 149 () { |
| 150 initGraph(["app|foo.txt"], {"app": [ |
| 151 // Have a dummy transformer so that barback at least tries to load the |
| 152 // asset. |
| 153 [new RewriteTransformer("a", "b")] |
| 154 ]}); |
| 155 |
| 156 setAssetError("app|foo.txt", async: false); |
| 157 updateSources(["app|foo.txt"]); |
| 158 expectNoAsset("app|foo.txt"); |
| 159 buildShouldFail([ |
| 160 isAssetLoadException("app|foo.txt", isMockLoadException("app|foo.txt")) |
| 161 ]); |
| 162 }); |
| 163 |
| 148 test("an asset isn't passed through a transformer with an error", () { | 164 test("an asset isn't passed through a transformer with an error", () { |
| 149 initGraph(["app|foo.txt"], {"app": [[new BadTransformer([])]]}); | 165 initGraph(["app|foo.txt"], {"app": [[new BadTransformer([])]]}); |
| 150 | 166 |
| 151 updateSources(["app|foo.txt"]); | 167 updateSources(["app|foo.txt"]); |
| 152 expectNoAsset("app|foo.txt"); | 168 expectNoAsset("app|foo.txt"); |
| 153 buildShouldFail([isTransformerException(equals(BadTransformer.ERROR))]); | 169 buildShouldFail([isTransformerException(equals(BadTransformer.ERROR))]); |
| 154 }); | 170 }); |
| 155 | 171 |
| 156 test("a transformer that logs errors shouldn't produce output", () { | 172 test("a transformer that logs errors shouldn't produce output", () { |
| 157 initGraph(["app|foo.txt"], {"app": [ | 173 initGraph(["app|foo.txt"], {"app": [ |
| (...skipping 30 matching lines...) Expand all Loading... |
| 188 | 204 |
| 189 updateSources(["app|foo.txt"]); | 205 updateSources(["app|foo.txt"]); |
| 190 expectNoAsset("app|foo.out"); | 206 expectNoAsset("app|foo.out"); |
| 191 buildShouldFail([isMissingInputException("app|bar.inc")]); | 207 buildShouldFail([isMissingInputException("app|bar.inc")]); |
| 192 | 208 |
| 193 updateSources(["app|bar.inc"]); | 209 updateSources(["app|bar.inc"]); |
| 194 expectAsset("app|foo.out", "bar"); | 210 expectAsset("app|foo.out", "bar"); |
| 195 buildShouldSucceed(); | 211 buildShouldSucceed(); |
| 196 }); | 212 }); |
| 197 } | 213 } |
| OLD | NEW |