Index: sdk/lib/_internal/pub/test/transformer/prefers_transformer_to_library_name_test.dart |
diff --git a/sdk/lib/_internal/pub/test/transformer/can_use_read_input_as_string_test.dart b/sdk/lib/_internal/pub/test/transformer/prefers_transformer_to_library_name_test.dart |
similarity index 63% |
copy from sdk/lib/_internal/pub/test/transformer/can_use_read_input_as_string_test.dart |
copy to sdk/lib/_internal/pub/test/transformer/prefers_transformer_to_library_name_test.dart |
index 0084d5c8105331a836391d2652ce764ef03551f3..1019a6e25cd6b4b6e7bf1d44925dca1a08b15415 100644 |
--- a/sdk/lib/_internal/pub/test/transformer/can_use_read_input_as_string_test.dart |
+++ b/sdk/lib/_internal/pub/test/transformer/prefers_transformer_to_library_name_test.dart |
@@ -8,7 +8,7 @@ import '../descriptor.dart' as d; |
import '../test_pub.dart'; |
import '../serve/utils.dart'; |
-const TRANSFORMER = """ |
+const WRONG_TRANSFORMER = """ |
import 'dart:async'; |
import 'package:barback/barback.dart'; |
@@ -19,10 +19,9 @@ class RewriteTransformer extends Transformer { |
String get allowedExtensions => '.txt'; |
Future apply(Transform transform) { |
- return transform.readInputAsString(transform.primaryInput.id) |
- .then((contents) { |
- var id = transform.primaryInput.id.changeExtension(".out"); |
- transform.addOutput(new Asset.fromString(id, "\$contents.out")); |
+ return transform.primaryInput.readAsString().then((contents) { |
+ var id = transform.primaryInput.id.changeExtension(".wrong"); |
+ transform.addOutput(new Asset.fromString(id, "\$contents.wrong")); |
}); |
} |
} |
@@ -30,15 +29,16 @@ class RewriteTransformer extends Transformer { |
main() { |
initConfig(); |
- integration("a transform can use readInputAsString", () { |
+ integration("prefers transformer.dart to <package name>.dart", () { |
d.dir(appPath, [ |
d.pubspec({ |
"name": "myapp", |
- "transformers": ["myapp/src/transformer"] |
+ "transformers": ["myapp"] |
}), |
- d.dir("lib", [d.dir("src", [ |
- d.file("transformer.dart", TRANSFORMER) |
- ])]), |
+ d.dir("lib", [ |
+ d.file("transformer.dart", REWRITE_TRANSFORMER), |
+ d.file("myapp.dart", WRONG_TRANSFORMER) |
+ ]), |
d.dir("web", [ |
d.file("foo.txt", "foo") |
]) |
@@ -48,6 +48,7 @@ main() { |
startPubServe(); |
requestShouldSucceed("foo.out", "foo.out"); |
+ requestShould404("foo.wrong"); |
endPubServe(); |
}); |
} |