OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library pub_tests; | 5 library pub_tests; |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 | 8 |
9 import '../../descriptor.dart' as d; | 9 import '../../descriptor.dart' as d; |
10 import '../../test_pub.dart'; | 10 import '../../test_pub.dart'; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 var id = transform.primaryInput.id.changeExtension(".out"); | 42 var id = transform.primaryInput.id.changeExtension(".out"); |
43 transform.addOutput(new Asset.fromString(id, "\$contents.out")); | 43 transform.addOutput(new Asset.fromString(id, "\$contents.out")); |
44 }); | 44 }); |
45 } | 45 } |
46 } | 46 } |
47 """; | 47 """; |
48 | 48 |
49 main() { | 49 main() { |
50 initConfig(); | 50 initConfig(); |
51 withBarbackVersions("any", () { | 51 withBarbackVersions("any", () { |
52 integration("with configuration, only instantiates configurable " | 52 integration( |
53 "transformers", () { | 53 "with configuration, only instantiates configurable " "transformers", |
54 var configuration = {"param": ["list", "of", "values"]}; | 54 () { |
| 55 var configuration = { |
| 56 "param": ["list", "of", "values"] |
| 57 }; |
55 | 58 |
56 d.dir(appPath, [ | 59 d.dir(appPath, [d.pubspec({ |
57 d.pubspec({ | 60 "name": "myapp", |
58 "name": "myapp", | 61 "transformers": [{ |
59 "transformers": [{"myapp/src/transformer": configuration}] | 62 "myapp/src/transformer": configuration |
60 }), | 63 }] |
61 d.dir("lib", [d.dir("src", [ | 64 }), |
62 d.file("transformer.dart", transformer) | 65 d.dir("lib", [d.dir("src", [d.file("transformer.dart", transformer)]
)]), |
63 ])]), | 66 d.dir("web", [d.file("foo.txt", "foo")])]).create(); |
64 d.dir("web", [ | |
65 d.file("foo.txt", "foo") | |
66 ]) | |
67 ]).create(); | |
68 | 67 |
69 createLockFile('myapp', pkg: ['barback']); | 68 createLockFile('myapp', pkg: ['barback']); |
70 | 69 |
71 var server = pubServe(); | 70 var server = pubServe(); |
72 requestShouldSucceed("foo.json", JSON.encode(configuration)); | 71 requestShouldSucceed("foo.json", JSON.encode(configuration)); |
73 requestShould404("foo.out"); | 72 requestShould404("foo.out"); |
74 endPubServe(); | 73 endPubServe(); |
75 }); | 74 }); |
76 }); | 75 }); |
77 } | 76 } |
OLD | NEW |