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

Unified Diff: sdk/lib/_internal/pub/test/snapshot/doesnt_load_irrelevant_transformers_test.dart

Issue 566743002: Don't try to load unnecessary transformers when precompiling executables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
Index: sdk/lib/_internal/pub/test/snapshot/doesnt_load_irrelevant_transformers_test.dart
diff --git a/sdk/lib/_internal/pub/test/snapshot/snapshots_transformed_code_test.dart b/sdk/lib/_internal/pub/test/snapshot/doesnt_load_irrelevant_transformers_test.dart
similarity index 60%
copy from sdk/lib/_internal/pub/test/snapshot/snapshots_transformed_code_test.dart
copy to sdk/lib/_internal/pub/test/snapshot/doesnt_load_irrelevant_transformers_test.dart
index 7c35cdc38be21baffdefe94d34381a46e85c70ea..b0b412d892aa21b750ed19abcb75a74efca96ab5 100644
--- a/sdk/lib/_internal/pub/test/snapshot/snapshots_transformed_code_test.dart
+++ b/sdk/lib/_internal/pub/test/snapshot/doesnt_load_irrelevant_transformers_test.dart
@@ -10,47 +10,47 @@ import 'package:scheduled_test/scheduled_test.dart';
import '../descriptor.dart' as d;
import '../test_pub.dart';
-const REPLACE_TRANSFORMER = """
+const BROKEN_TRANSFORMER = """
import 'dart:async';
import 'package:barback/barback.dart';
-class ReplaceTransformer extends Transformer {
- ReplaceTransformer.asPlugin();
+class BrokenTransformer extends Transformer {
+ BrokenTransformer.asPlugin();
- String get allowedExtensions => '.dart';
-
- Future apply(Transform transform) {
- return transform.primaryInput.readAsString().then((contents) {
- transform.addOutput(new Asset.fromString(transform.primaryInput.id,
- contents.replaceAll("REPLACE ME", "hello!")));
- });
- }
-}
+ // This file intentionally has a syntax error so that any attempt to load it
+ // will crash.
""";
main() {
initConfig();
+
+ // Regression test for issue 20917.
integration("snapshots the transformed version of an executable", () {
servePackages((builder) {
builder.serveRepoPackage('barback');
builder.serve("foo", "1.2.3",
- deps: {"barback": "any"},
- pubspec: {'transformers': ['foo']},
contents: [
- d.dir("lib", [d.file("foo.dart", REPLACE_TRANSFORMER)]),
d.dir("bin", [
- d.file("hello.dart", """
-final message = 'REPLACE ME';
-
-void main() => print(message);
-"""),
+ d.file("hello.dart", "void main() => print('hello!');")
])
]);
});
- d.appDir({"foo": "1.2.3"}).create();
+ d.dir(appPath, [
+ d.pubspec({
+ "name": "myapp",
+ "dependencies": {
+ "foo": "1.2.3",
+ "barback": "any"
+ },
+ "transformers": ["myapp"]
+ }),
+ d.dir("lib", [
+ d.file("transformer.dart", BROKEN_TRANSFORMER)
+ ])
+ ]).create();
pubGet(output: contains("Precompiled foo:hello."));

Powered by Google App Engine
This is Rietveld 408576698