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