OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS 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 'package:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; |
8 import 'package:scheduled_test/scheduled_test.dart'; | 8 import 'package:scheduled_test/scheduled_test.dart'; |
9 | 9 |
10 import '../descriptor.dart' as d; | 10 import '../descriptor.dart' as d; |
(...skipping 14 matching lines...) Expand all Loading... |
25 transform.addOutput(new Asset.fromString(transform.primaryInput.id, | 25 transform.addOutput(new Asset.fromString(transform.primaryInput.id, |
26 contents.replaceAll("REPLACE ME", "hello!"))); | 26 contents.replaceAll("REPLACE ME", "hello!"))); |
27 }); | 27 }); |
28 } | 28 } |
29 } | 29 } |
30 """; | 30 """; |
31 | 31 |
32 main() { | 32 main() { |
33 integration("snapshots the transformed version of an executable", () { | 33 integration("snapshots the transformed version of an executable", () { |
34 servePackages((builder) { | 34 servePackages((builder) { |
35 builder.serveRepoPackage('barback'); | 35 builder.serveRealPackage('barback'); |
36 | 36 |
37 builder.serve("foo", "1.2.3", | 37 builder.serve("foo", "1.2.3", |
38 deps: {"barback": "any"}, | 38 deps: {"barback": "any"}, |
39 pubspec: {'transformers': ['foo']}, | 39 pubspec: {'transformers': ['foo']}, |
40 contents: [ | 40 contents: [ |
41 d.dir("lib", [d.file("foo.dart", REPLACE_TRANSFORMER)]), | 41 d.dir("lib", [d.file("foo.dart", REPLACE_TRANSFORMER)]), |
42 d.dir("bin", [ | 42 d.dir("bin", [ |
43 d.file("hello.dart", """ | 43 d.file("hello.dart", """ |
44 final message = 'REPLACE ME'; | 44 final message = 'REPLACE ME'; |
45 | 45 |
46 void main() => print(message); | 46 void main() => print(message); |
47 """), | 47 """), |
48 ]) | 48 ]) |
49 ]); | 49 ]); |
50 }); | 50 }); |
51 | 51 |
52 d.appDir({"foo": "1.2.3"}).create(); | 52 d.appDir({"foo": "1.2.3"}).create(); |
53 | 53 |
54 pubGet(output: contains("Precompiled foo:hello.")); | 54 pubGet(output: contains("Precompiled foo:hello.")); |
55 | 55 |
56 d.dir(p.join(appPath, '.pub', 'bin'), [ | 56 d.dir(p.join(appPath, '.pub', 'bin'), [ |
57 d.dir('foo', [d.matcherFile('hello.dart.snapshot', contains('hello!'))]) | 57 d.dir('foo', [d.matcherFile('hello.dart.snapshot', contains('hello!'))]) |
58 ]).validate(); | 58 ]).validate(); |
59 | 59 |
60 var process = pubRun(args: ['foo:hello']); | 60 var process = pubRun(args: ['foo:hello']); |
61 process.stdout.expect("hello!"); | 61 process.stdout.expect("hello!"); |
62 process.shouldExit(); | 62 process.shouldExit(); |
63 }); | 63 }); |
64 } | 64 } |
OLD | NEW |