Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: sdk/lib/_internal/pub/test/transformer/can_use_read_input_test.dart

Issue 29343004: Support all Transform methods on ForeignTransform. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub/test/transformer/can_use_read_input_as_string_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/test/transformer/can_use_read_input_test.dart
diff --git a/sdk/lib/_internal/pub/test/transformer/prints_a_transform_error_in_apply_test.dart b/sdk/lib/_internal/pub/test/transformer/can_use_read_input_test.dart
similarity index 62%
copy from sdk/lib/_internal/pub/test/transformer/prints_a_transform_error_in_apply_test.dart
copy to sdk/lib/_internal/pub/test/transformer/can_use_read_input_test.dart
index ac8f11295c3ecba2c10d95195fa669f56732cd6e..7fde01a76c0b43a0a20d422af2d5305de3e9adc4 100644
--- a/sdk/lib/_internal/pub/test/transformer/prints_a_transform_error_in_apply_test.dart
+++ b/sdk/lib/_internal/pub/test/transformer/can_use_read_input_test.dart
@@ -4,13 +4,11 @@
library pub_tests;
-import 'package:scheduled_test/scheduled_test.dart';
-
import '../descriptor.dart' as d;
import '../test_pub.dart';
import '../serve/utils.dart';
-final transformer = """
+const TRANSFORMER = """
import 'dart:async';
import 'package:barback/barback.dart';
@@ -20,20 +18,27 @@ class RewriteTransformer extends Transformer {
String get allowedExtensions => '.txt';
- Future apply(Transform transform) => throw new Exception('oh no!');
+ Future apply(Transform transform) {
+ return transform.readInput(transform.primaryInput.id).toList()
+ .then((contents) {
+ var id = transform.primaryInput.id.changeExtension(".out");
+ var asset = new Asset.fromString(id, "\$contents.out");
+ transform.addOutput(asset);
+ });
+ }
}
""";
main() {
initConfig();
- integration("prints a transform error in apply", () {
+ integration("a transform can use readInputAsString", () {
d.dir(appPath, [
d.pubspec({
"name": "myapp",
"transformers": ["myapp/src/transformer"]
}),
d.dir("lib", [d.dir("src", [
- d.file("transformer.dart", transformer)
+ d.file("transformer.dart", TRANSFORMER)
])]),
d.dir("web", [
d.file("foo.txt", "foo")
@@ -42,11 +47,8 @@ main() {
createLockFile('myapp', pkg: ['barback']);
- var server = startPubServe();
- expect(server.nextErrLine(),
- completion(equals('Build error:')));
- expect(server.nextErrLine(), completion(equals('Transform Rewrite on '
- 'myapp|web/foo.txt threw error: oh no!')));
+ startPubServe();
+ requestShouldSucceed("foo.out", "[[102 111 111]].out");
endPubServe();
});
}
« no previous file with comments | « sdk/lib/_internal/pub/test/transformer/can_use_read_input_as_string_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698