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

Side by Side Diff: dart/sdk/lib/_internal/pub_generated/test/transformer/cache_test.dart

Issue 651483004: Version 1.7.2 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.7/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library pub_tests; 1 library pub_tests;
2 import 'package:scheduled_test/scheduled_stream.dart';
2 import 'package:scheduled_test/scheduled_test.dart'; 3 import 'package:scheduled_test/scheduled_test.dart';
3 import '../descriptor.dart' as d; 4 import '../descriptor.dart' as d;
4 import '../test_pub.dart'; 5 import '../test_pub.dart';
5 import '../serve/utils.dart'; 6 import '../serve/utils.dart';
6 const REPLACE_FROM_LIBRARY_TRANSFORMER = """ 7 const REPLACE_FROM_LIBRARY_TRANSFORMER = """
7 import 'dart:async'; 8 import 'dart:async';
8 9
9 import 'package:barback/barback.dart'; 10 import 'package:barback/barback.dart';
10 import 'package:bar/bar.dart'; 11 import 'package:bar/bar.dart';
11 12
(...skipping 21 matching lines...) Expand all
33 d.dir( 34 d.dir(
34 "lib", 35 "lib",
35 [d.file("transformer.dart", replaceTransformer("Hello", "Goodbye "))])]); 36 [d.file("transformer.dart", replaceTransformer("Hello", "Goodbye "))])]);
36 builder.serve("bar", "1.2.3", deps: { 37 builder.serve("bar", "1.2.3", deps: {
37 'barback': 'any' 38 'barback': 'any'
38 }, 39 },
39 contents: [ 40 contents: [
40 d.dir( 41 d.dir(
41 "lib", 42 "lib",
42 [d.file("transformer.dart", replaceTransformer("Goodbye", "See y a"))])]); 43 [d.file("transformer.dart", replaceTransformer("Goodbye", "See y a"))])]);
44 builder.serve("baz", "1.2.3");
43 }); 45 });
44 d.dir(appPath, [d.pubspec({ 46 d.dir(appPath, [d.pubspec({
45 "name": "myapp", 47 "name": "myapp",
46 "dependencies": { 48 "dependencies": {
47 "foo": "1.2.3", 49 "foo": "1.2.3",
48 "bar": "1.2.3" 50 "bar": "1.2.3"
49 }, 51 },
50 "transformers": ["foo"] 52 "transformers": ["foo"]
51 }), 53 }),
52 d.dir("bin", [d.file("myapp.dart", "main() => print('Hello!');")])]).cre ate(); 54 d.dir("bin", [d.file("myapp.dart", "main() => print('Hello!');")])]).cre ate();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 "dependencies": { 210 "dependencies": {
209 "foo": "any" 211 "foo": "any"
210 }, 212 },
211 "transformers": ["foo"] 213 "transformers": ["foo"]
212 })]).create(); 214 })]).create();
213 pubUpgrade(); 215 pubUpgrade();
214 process = pubRun(args: ['myapp']); 216 process = pubRun(args: ['myapp']);
215 process.stdout.expect("See ya!"); 217 process.stdout.expect("See ya!");
216 process.shouldExit(); 218 process.shouldExit();
217 }); 219 });
220 integration("doesn't recache when a transformer is removed", () {
221 setUp();
222 d.dir(appPath, [d.pubspec({
223 "name": "myapp",
224 "dependencies": {
225 "foo": "1.2.3",
226 "bar": "1.2.3"
227 },
228 "transformers": ["foo", "bar"]
229 }),
230 d.dir("bin", [d.file("myapp.dart", "main() => print('Hello!');")])]).c reate();
231 var process = pubRun(args: ['myapp']);
232 process.stdout.expect("See ya!");
233 process.shouldExit();
234 d.dir(appPath, [d.pubspec({
235 "name": "myapp",
236 "dependencies": {
237 "foo": "1.2.3",
238 "baz": "1.2.3"
239 },
240 "transformers": ["foo"]
241 }),
242 d.dir("bin", [d.file("myapp.dart", "main() => print('Hello!');")])]).c reate();
243 process = pubRun(args: ['myapp']);
244 process.stdout.expect(
245 "Your pubspec has changed, so we need to update your lockfile:");
246 process.stdout.expect(consumeThrough("Goodbye!"));
247 process.shouldExit();
248 d.dir(
249 appPath,
250 [
251 d.dir(
252 ".pub/transformers",
253 [
254 d.file("manifest.txt", "0.1.2+3\nbar,foo"),
255 d.matcherFile("transformers.snapshot", isNot(isEmpty))])]).v alidate();
256 });
218 } 257 }
219 String replaceTransformer(String input, String output) { 258 String replaceTransformer(String input, String output) {
220 return """ 259 return """
221 import 'dart:async'; 260 import 'dart:async';
222 261
223 import 'package:barback/barback.dart'; 262 import 'package:barback/barback.dart';
224 263
225 class ReplaceTransformer extends Transformer { 264 class ReplaceTransformer extends Transformer {
226 ReplaceTransformer.asPlugin(); 265 ReplaceTransformer.asPlugin();
227 266
228 String get allowedExtensions => '.dart'; 267 String get allowedExtensions => '.dart';
229 268
230 Future apply(Transform transform) { 269 Future apply(Transform transform) {
231 return transform.primaryInput.readAsString().then((contents) { 270 return transform.primaryInput.readAsString().then((contents) {
232 transform.addOutput(new Asset.fromString( 271 transform.addOutput(new Asset.fromString(
233 transform.primaryInput.id, 272 transform.primaryInput.id,
234 contents.replaceAll("$input", "$output"))); 273 contents.replaceAll("$input", "$output")));
235 }); 274 });
236 } 275 }
237 } 276 }
238 """; 277 """;
239 } 278 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/pub_generated/lib/src/barback/transformer_cache.dart ('k') | dart/tools/VERSION » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698