| Index: sdk/lib/_internal/pub/test/transformer/supports_a_transformer_that_doesnt_return_futures_test.dart
|
| diff --git a/sdk/lib/_internal/pub/test/transformer/can_use_consume_primary_test.dart b/sdk/lib/_internal/pub/test/transformer/supports_a_transformer_that_doesnt_return_futures_test.dart
|
| similarity index 62%
|
| copy from sdk/lib/_internal/pub/test/transformer/can_use_consume_primary_test.dart
|
| copy to sdk/lib/_internal/pub/test/transformer/supports_a_transformer_that_doesnt_return_futures_test.dart
|
| index 9b41b2bbc5905412e31e2c3d02224973d5b1ff64..e4ac4ef7e5fb32a25f00338dac7180fbe2c41902 100644
|
| --- a/sdk/lib/_internal/pub/test/transformer/can_use_consume_primary_test.dart
|
| +++ b/sdk/lib/_internal/pub/test/transformer/supports_a_transformer_that_doesnt_return_futures_test.dart
|
| @@ -13,25 +13,25 @@ import 'dart:async';
|
|
|
| import 'package:barback/barback.dart';
|
|
|
| -class RewriteTransformer extends Transformer {
|
| +class RewriteTransformer extends Transformer implements DeclaringTransformer {
|
| RewriteTransformer.asPlugin();
|
|
|
| - String get allowedExtensions => '.txt';
|
| + bool isPrimary(AssetId id) => id.extension == '.txt';
|
|
|
| - Future apply(Transform transform) {
|
| - transform.consumePrimary();
|
| - return transform.primaryInput.readAsString().then((contents) {
|
| - var id = transform.primaryInput.id.changeExtension(".out");
|
| - var asset = new Asset.fromString(id, "\$contents.out");
|
| - transform.addOutput(asset);
|
| - });
|
| + void apply(Transform transform) {
|
| + transform.addOutput(new Asset.fromString(
|
| + transform.primaryInput.id, "new contents"));
|
| + }
|
| +
|
| + void declareOutputs(DeclaringTransform transform) {
|
| + transform.declareOutput(transform.primaryId);
|
| }
|
| }
|
| """;
|
|
|
| main() {
|
| initConfig();
|
| - integration("a transform can use consumePrimary", () {
|
| + integration("supports a transformer that doesn't return futures", () {
|
| d.dir(appPath, [
|
| d.pubspec({
|
| "name": "myapp",
|
| @@ -48,8 +48,7 @@ main() {
|
| createLockFile('myapp', pkg: ['barback']);
|
|
|
| pubServe();
|
| - requestShouldSucceed("foo.out", "foo.out");
|
| - requestShould404("foo.txt");
|
| + requestShouldSucceed("foo.txt", "new contents");
|
| endPubServe();
|
| });
|
| }
|
|
|