OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2014, 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 '../descriptor.dart' as d; | 7 import '../descriptor.dart' as d; |
8 import '../test_pub.dart'; | 8 import '../test_pub.dart'; |
9 import 'utils.dart'; | 9 import 'utils.dart'; |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 Future declareOutputs(DeclaringTransform transform) { | 30 Future declareOutputs(DeclaringTransform transform) { |
31 transform.declareOutput(transform.primaryId.changeExtension(".final")); | 31 transform.declareOutput(transform.primaryId.changeExtension(".final")); |
32 return new Future.value(); | 32 return new Future.value(); |
33 } | 33 } |
34 } | 34 } |
35 """; | 35 """; |
36 | 36 |
37 main() { | 37 main() { |
38 integration("supports a user-defined declaring transformer", () { | 38 integration("supports a user-defined declaring transformer", () { |
| 39 serveBarback(); |
| 40 |
39 d.dir(appPath, [ | 41 d.dir(appPath, [ |
40 d.pubspec({ | 42 d.pubspec({ |
41 "name": "myapp", | 43 "name": "myapp", |
42 "transformers": ["myapp/src/lazy", "myapp/src/declaring"] | 44 "transformers": ["myapp/src/lazy", "myapp/src/declaring"], |
| 45 "dependencies": {"barback": "any"} |
43 }), | 46 }), |
44 d.dir("lib", [d.dir("src", [ | 47 d.dir("lib", [d.dir("src", [ |
45 // Include a lazy transformer before the declaring transformer, | 48 // Include a lazy transformer before the declaring transformer, |
46 // because otherwise its behavior is indistinguishable from a normal | 49 // because otherwise its behavior is indistinguishable from a normal |
47 // transformer. | 50 // transformer. |
48 d.file("lazy.dart", LAZY_TRANSFORMER), | 51 d.file("lazy.dart", LAZY_TRANSFORMER), |
49 d.file("declaring.dart", DECLARING_TRANSFORMER) | 52 d.file("declaring.dart", DECLARING_TRANSFORMER) |
50 ])]), | 53 ])]), |
51 d.dir("web", [ | 54 d.dir("web", [ |
52 d.file("foo.txt", "foo") | 55 d.file("foo.txt", "foo") |
53 ]) | 56 ]) |
54 ]).create(); | 57 ]).create(); |
55 | 58 |
56 createLockFile('myapp', pkg: ['barback']); | 59 pubGet(); |
57 | |
58 var server = pubServe(); | 60 var server = pubServe(); |
59 // The build should complete without either transformer logging anything. | 61 // The build should complete without either transformer logging anything. |
60 server.stdout.expect('Build completed successfully'); | 62 server.stdout.expect('Build completed successfully'); |
61 | 63 |
62 requestShouldSucceed("foo.final", "foo.out.final"); | 64 requestShouldSucceed("foo.final", "foo.out.final"); |
63 server.stdout.expect(emitsLines( | 65 server.stdout.expect(emitsLines( |
64 '[Info from LazyRewrite]:\n' | 66 '[Info from LazyRewrite]:\n' |
65 'Rewriting myapp|web/foo.txt.\n' | 67 'Rewriting myapp|web/foo.txt.\n' |
66 '[Info from DeclaringRewrite]:\n' | 68 '[Info from DeclaringRewrite]:\n' |
67 'Rewriting myapp|web/foo.out.')); | 69 'Rewriting myapp|web/foo.out.')); |
68 endPubServe(); | 70 endPubServe(); |
69 }); | 71 }); |
70 } | 72 } |
OLD | NEW |