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.transformer.bad_log; | 5 library barback.test.transformer.bad_log; |
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'; |
11 | 11 |
12 import 'mock.dart'; | 12 import 'mock.dart'; |
13 | 13 |
14 /// A transformer that logs an error when run, Before generating the given | 14 /// A transformer that logs an error when run, Before generating the given |
15 /// outputs. | 15 /// outputs. |
16 class BadLogTransformer extends MockTransformer { | 16 class BadLogTransformer extends MockTransformer { |
17 /// The list of asset names that it should output. | 17 /// The list of asset names that it should output. |
18 final List<String> outputs; | 18 final List<String> outputs; |
19 | 19 |
20 BadLogTransformer(this.outputs); | 20 BadLogTransformer(this.outputs); |
21 | 21 |
22 Future<bool> doIsPrimary(Asset asset) => new Future.value(true); | 22 Future<bool> doIsPrimary(AssetId id) => new Future.value(true); |
23 | 23 |
24 Future doApply(Transform transform) { | 24 Future doApply(Transform transform) { |
25 return newFuture(() { | 25 return newFuture(() { |
26 transform.logger.error("first error"); | 26 transform.logger.error("first error"); |
27 transform.logger.error("second error"); | 27 transform.logger.error("second error"); |
28 | 28 |
29 for (var output in outputs) { | 29 for (var output in outputs) { |
30 var id = new AssetId.parse(output); | 30 var id = new AssetId.parse(output); |
31 transform.addOutput(new Asset.fromString(id, output)); | 31 transform.addOutput(new Asset.fromString(id, output)); |
32 } | 32 } |
33 }); | 33 }); |
34 } | 34 } |
35 } | 35 } |
OLD | NEW |