| 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 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:barback/barback.dart'; | 9 import 'package:barback/barback.dart'; |
| 10 import 'package:barback/src/utils.dart'; | 10 import 'package:barback/src/utils.dart'; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // next version of foo.out in line. | 277 // next version of foo.out in line. |
| 278 // TODO(nweiz): Should this emit a collision error as well? Or should they | 278 // TODO(nweiz): Should this emit a collision error as well? Or should they |
| 279 // only be emitted when a file is added or removed? | 279 // only be emitted when a file is added or removed? |
| 280 updateSources(["app|foo.three"]); | 280 updateSources(["app|foo.three"]); |
| 281 buildShouldSucceed(); | 281 buildShouldSucceed(); |
| 282 | 282 |
| 283 removeSources(["app|foo.one"]); | 283 removeSources(["app|foo.one"]); |
| 284 expectAsset("app|foo.out", "two.out"); | 284 expectAsset("app|foo.out", "two.out"); |
| 285 buildShouldFail([isAssetCollisionException("app|foo.out")]); | 285 buildShouldFail([isAssetCollisionException("app|foo.out")]); |
| 286 }); | 286 }); |
| 287 |
| 288 test("a collision with a pass-through asset returns the pass-through asset", |
| 289 () { |
| 290 initGraph([ |
| 291 "app|foo.txt", |
| 292 "app|foo.in" |
| 293 ], {"app": [ |
| 294 [new RewriteTransformer("in", "txt")] |
| 295 ]}); |
| 296 |
| 297 updateSources(["app|foo.txt", "app|foo.in"]); |
| 298 expectAsset("app|foo.txt", "foo"); |
| 299 buildShouldFail([isAssetCollisionException("app|foo.txt")]); |
| 300 }); |
| 301 |
| 302 test("a new pass-through asset that collides returns the previous asset", () { |
| 303 initGraph([ |
| 304 "app|foo.txt", |
| 305 "app|foo.in" |
| 306 ], {"app": [ |
| 307 [new RewriteTransformer("in", "txt")] |
| 308 ]}); |
| 309 |
| 310 updateSources(["app|foo.in"]); |
| 311 expectAsset("app|foo.txt", "foo.txt"); |
| 312 buildShouldSucceed(); |
| 313 |
| 314 updateSources(["app|foo.txt"]); |
| 315 expectAsset("app|foo.txt", "foo.txt"); |
| 316 buildShouldFail([isAssetCollisionException("app|foo.txt")]); |
| 317 }); |
| 318 |
| 319 test("a new transform output that collides with a pass-through asset returns " |
| 320 "the pass-through asset", () { |
| 321 initGraph([ |
| 322 "app|foo.txt", |
| 323 "app|foo.in" |
| 324 ], {"app": [ |
| 325 [new RewriteTransformer("in", "txt")] |
| 326 ]}); |
| 327 |
| 328 updateSources(["app|foo.txt"]); |
| 329 expectAsset("app|foo.txt", "foo"); |
| 330 buildShouldSucceed(); |
| 331 |
| 332 updateSources(["app|foo.in"]); |
| 333 expectAsset("app|foo.txt", "foo"); |
| 334 buildShouldFail([isAssetCollisionException("app|foo.txt")]); |
| 335 }); |
| 287 } | 336 } |
| OLD | NEW |