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 20 matching lines...) Expand all Loading... |
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 initConfig(); | 38 initConfig(); |
39 withBarbackVersions("any", () { | 39 withBarbackVersions("any", () { |
40 integration("supports a user-defined declaring transformer", () { | 40 integration("supports a user-defined declaring transformer", () { |
41 d.dir(appPath, [ | 41 d.dir(appPath, [d.pubspec({ |
42 d.pubspec({ | |
43 "name": "myapp", | 42 "name": "myapp", |
44 "transformers": ["myapp/src/lazy", "myapp/src/declaring"] | 43 "transformers": ["myapp/src/lazy", "myapp/src/declaring"] |
45 }), | 44 }), |
46 d.dir("lib", [d.dir("src", [ | 45 d.dir( |
47 // Include a lazy transformer before the declaring transformer, | 46 "lib", |
48 // because otherwise its behavior is indistinguishable from a normal | 47 [d.dir("src", [// Include a lazy transformer before the declarin
g transformer, |
49 // transformer. | 48 // because otherwise its behavior is indistinguishable from a normal |
50 d.file("lazy.dart", LAZY_TRANSFORMER), | 49 // transformer. |
51 d.file("declaring.dart", DECLARING_TRANSFORMER) | 50 d.file("lazy.dart", LAZY_TRANSFORMER), |
52 ])]), | 51 d.file("declaring.dart", DECLARING_TRANSFORMER)])]), |
53 d.dir("web", [ | 52 d.dir("web", [d.file("foo.txt", "foo")])]).create(); |
54 d.file("foo.txt", "foo") | |
55 ]) | |
56 ]).create(); | |
57 | 53 |
58 createLockFile('myapp', pkg: ['barback']); | 54 createLockFile('myapp', pkg: ['barback']); |
59 | 55 |
60 var server = pubServe(); | 56 var server = pubServe(); |
61 // The build should complete without either transformer logging anything. | 57 // The build should complete without either transformer logging anything. |
62 server.stdout.expect('Build completed successfully'); | 58 server.stdout.expect('Build completed successfully'); |
63 | 59 |
64 requestShouldSucceed("foo.final", "foo.out.final"); | 60 requestShouldSucceed("foo.final", "foo.out.final"); |
65 server.stdout.expect(emitsLines( | 61 server.stdout.expect( |
66 '[Info from LazyRewrite]:\n' | 62 emitsLines( |
67 'Rewriting myapp|web/foo.txt.\n' | 63 '[Info from LazyRewrite]:\n' 'Rewriting myapp|web/foo.txt.\n' |
68 '[Info from DeclaringRewrite]:\n' | 64 '[Info from DeclaringRewrite]:\n' 'Rewriting myapp|web/foo.out
.')); |
69 'Rewriting myapp|web/foo.out.')); | |
70 endPubServe(); | 65 endPubServe(); |
71 }); | 66 }); |
72 }); | 67 }); |
73 } | 68 } |
OLD | NEW |