Index: pkg/barback/test/transformer/lazy_bad.dart |
diff --git a/pkg/barback/test/transformer/bad.dart b/pkg/barback/test/transformer/lazy_bad.dart |
similarity index 52% |
copy from pkg/barback/test/transformer/bad.dart |
copy to pkg/barback/test/transformer/lazy_bad.dart |
index 49046ca5b45aed5e05dda27f5de0121ecd6aac9a..170e0a0f70a05033c5a3bbdcb199064f5f2472ec 100644 |
--- a/pkg/barback/test/transformer/bad.dart |
+++ b/pkg/barback/test/transformer/lazy_bad.dart |
@@ -11,28 +11,29 @@ import 'package:barback/src/utils.dart'; |
import 'mock.dart'; |
-/// A transformer that throws an exception when run, after generating the |
-/// given outputs. |
-class BadTransformer extends MockTransformer { |
- /// The error it throws. |
+/// A lazy transformer that throw an exception after [dryRun]. |
Bob Nystrom
2014/01/30 19:33:44
throw -> throws
nweiz
2014/01/31 03:43:27
Done.
|
+class LazyBadTransformer extends MockTransformer implements LazyTransformer { |
+ /// The error [this] throws. |
static const ERROR = "I am a bad transformer!"; |
- /// The list of asset names that it should output. |
- final List<String> outputs; |
+ /// The asset name that [this] should output. |
+ final String output; |
- BadTransformer(this.outputs); |
+ LazyBadTransformer(this.output); |
Future<bool> doIsPrimary(Asset asset) => new Future.value(true); |
Future doApply(Transform transform) { |
return newFuture(() { |
- // Create the outputs first. |
- for (var output in outputs) { |
- var id = new AssetId.parse(output); |
- transform.addOutput(new Asset.fromString(id, output)); |
- } |
+ var id = new AssetId.parse(output); |
+ transform.addOutput(new Asset.fromString(id, output)); |
+ }); |
+ } |
- // Then fail. |
+ Future dryRun(DryRunTransform transform) { |
+ return newFuture(() { |
+ var id = new AssetId.parse(output); |
+ transform.addOutputId(id); |
throw ERROR; |
}); |
} |