| 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.barback_test; | 5 library barback.test.barback_test; |
| 6 | 6 |
| 7 import 'dart:async'; |
| 8 |
| 9 import 'package:barback/barback.dart'; |
| 7 import 'package:scheduled_test/scheduled_test.dart'; | 10 import 'package:scheduled_test/scheduled_test.dart'; |
| 8 | 11 |
| 9 import '../utils.dart'; | 12 import '../utils.dart'; |
| 10 | 13 |
| 11 main() { | 14 main() { |
| 12 initConfig(); | 15 initConfig(); |
| 13 | 16 |
| 14 test("gets all source assets", () { | 17 test("gets all source assets", () { |
| 15 initGraph(["app|a.txt", "app|b.txt", "app|c.txt"]); | 18 initGraph(["app|a.txt", "app|b.txt", "app|c.txt"]); |
| 16 updateSources(["app|a.txt", "app|b.txt", "app|c.txt"]); | 19 updateSources(["app|a.txt", "app|b.txt", "app|c.txt"]); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 new BadTransformer(["app|foo.out2"]) | 70 new BadTransformer(["app|foo.out2"]) |
| 68 ] | 71 ] |
| 69 ]}); | 72 ]}); |
| 70 | 73 |
| 71 updateSources(["app|foo.txt"]); | 74 updateSources(["app|foo.txt"]); |
| 72 expectAllAssetsShouldFail(isAggregateException([ | 75 expectAllAssetsShouldFail(isAggregateException([ |
| 73 isTransformerException(equals(BadTransformer.ERROR)), | 76 isTransformerException(equals(BadTransformer.ERROR)), |
| 74 isTransformerException(equals(BadTransformer.ERROR)) | 77 isTransformerException(equals(BadTransformer.ERROR)) |
| 75 ])); | 78 ])); |
| 76 }); | 79 }); |
| 80 |
| 81 // Regression test. |
| 82 test("getAllAssets() is called synchronously after after initializing " |
| 83 "barback", () { |
| 84 var provider = new MockProvider({ |
| 85 "app|a.txt": "a", |
| 86 "app|b.txt": "b", |
| 87 "app|c.txt": "c" |
| 88 }); |
| 89 var barback = new Barback(provider); |
| 90 barback.updateSources([ |
| 91 new AssetId.parse("app|a.txt"), |
| 92 new AssetId.parse("app|b.txt"), |
| 93 new AssetId.parse("app|c.txt") |
| 94 ]); |
| 95 |
| 96 expect(barback.getAllAssets().then((assets) { |
| 97 return Future.wait(assets.map((asset) => asset.readAsString())); |
| 98 }), completion(unorderedEquals(["a", "b", "c"]))); |
| 99 }); |
| 77 } | 100 } |
| OLD | NEW |