OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library pub_tests; | |
6 | |
7 import 'package:path/path.dart' as p; | |
8 import 'package:scheduled_test/scheduled_test.dart'; | |
9 | |
10 import '../descriptor.dart' as d; | |
11 import '../test_pub.dart'; | |
12 | |
13 main() { | |
14 initConfig(); | |
15 integration("upgrades a snapshot when a dependency is upgraded", () { | |
16 servePackages((builder) { | |
17 builder.serve("foo", "1.2.3", pubspec: { | |
18 "dependencies": {"bar": "any"} | |
19 }, contents: [ | |
20 d.dir("bin", [ | |
21 d.file("hello.dart", """ | |
22 import 'package:bar/bar.dart'; | |
23 | |
24 void main() => print(message); | |
25 """) | |
26 ]) | |
27 ]); | |
28 builder.serve("bar", "1.2.3", contents: [ | |
29 d.dir("lib", [d.file("bar.dart", "final message = 'hello!';")]) | |
30 ]); | |
31 }); | |
32 | |
33 d.appDir({"foo": "any"}).create(); | |
34 | |
35 pubGet(output: contains("Precompiled foo:hello.")); | |
36 | |
37 d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [ | |
38 d.matcherFile('hello.dart.snapshot', contains('hello!')) | |
39 ]).validate(); | |
40 | |
41 servePackages((builder) { | |
42 builder.serve("bar", "1.2.4", contents: [ | |
43 d.dir("lib", [d.file("bar.dart", "final message = 'hello 2!';")]), | |
44 ]); | |
45 }); | |
46 | |
47 pubUpgrade(output: contains("Precompiled foo:hello.")); | |
48 | |
49 d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [ | |
50 d.matcherFile('hello.dart.snapshot', contains('hello 2!')) | |
51 ]).validate(); | |
52 | |
53 var process = pubRun(args: ['foo:hello']); | |
54 process.stdout.expect("hello 2!"); | |
55 process.shouldExit(); | |
56 }); | |
57 } | |
OLD | NEW |