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

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

Issue 557563002: Store the async-await compiled pub code directly in the repo. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library pub_tests; 1 library pub_tests;
6
7 import 'dart:convert'; 2 import 'dart:convert';
8
9 import '../../descriptor.dart' as d; 3 import '../../descriptor.dart' as d;
10 import '../../test_pub.dart'; 4 import '../../test_pub.dart';
11 import '../../serve/utils.dart'; 5 import '../../serve/utils.dart';
12
13 final transformer = """ 6 final transformer = """
14 import 'dart:async'; 7 import 'dart:async';
15 import 'dart:convert'; 8 import 'dart:convert';
16 9
17 import 'package:barback/barback.dart'; 10 import 'package:barback/barback.dart';
18 11
19 class ConfigTransformer extends Transformer { 12 class ConfigTransformer extends Transformer {
20 final BarbackSettings settings; 13 final BarbackSettings settings;
21 14
22 ConfigTransformer.asPlugin(this.settings); 15 ConfigTransformer.asPlugin(this.settings);
23 16
24 String get allowedExtensions => '.txt'; 17 String get allowedExtensions => '.txt';
25 18
26 Future apply(Transform transform) { 19 Future apply(Transform transform) {
27 return transform.primaryInput.readAsString().then((contents) { 20 return transform.primaryInput.readAsString().then((contents) {
28 var id = transform.primaryInput.id.changeExtension(".json"); 21 var id = transform.primaryInput.id.changeExtension(".json");
29 transform.addOutput( 22 transform.addOutput(
30 new Asset.fromString(id, JSON.encode(settings.configuration))); 23 new Asset.fromString(id, JSON.encode(settings.configuration)));
31 }); 24 });
32 } 25 }
33 } 26 }
34 """; 27 """;
35
36 main() { 28 main() {
37 initConfig(); 29 initConfig();
38 withBarbackVersions("any", () { 30 withBarbackVersions("any", () {
39 integration("passes configuration to a transformer", () { 31 integration("passes configuration to a transformer", () {
40 var configuration = {"param": ["list", "of", "values"]}; 32 var configuration = {
41 33 "param": ["list", "of", "values"]
42 d.dir(appPath, [ 34 };
43 d.pubspec({ 35 d.dir(appPath, [d.pubspec({
44 "name": "myapp", 36 "name": "myapp",
45 "transformers": [{"myapp/src/transformer": configuration}] 37 "transformers": [{
38 "myapp/src/transformer": configuration
39 }]
46 }), 40 }),
47 d.dir("lib", [d.dir("src", [ 41 d.dir("lib", [d.dir("src", [d.file("transformer.dart", transformer)] )]),
48 d.file("transformer.dart", transformer) 42 d.dir("web", [d.file("foo.txt", "foo")])]).create();
49 ])]),
50 d.dir("web", [
51 d.file("foo.txt", "foo")
52 ])
53 ]).create();
54
55 createLockFile('myapp', pkg: ['barback']); 43 createLockFile('myapp', pkg: ['barback']);
56
57 var server = pubServe(); 44 var server = pubServe();
58 requestShouldSucceed("foo.json", JSON.encode(configuration)); 45 requestShouldSucceed("foo.json", JSON.encode(configuration));
59 endPubServe(); 46 endPubServe();
60 }); 47 });
61 }); 48 });
62 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698