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": { | |
19 "bar": "any" | |
20 } | |
21 }, contents: [d.dir("bin", [d.file("hello.dart", """ | |
22 import 'package:bar/bar.dart'; | |
23 | |
24 void main() => print(message); | |
25 """)])]); | |
26 builder.serve( | |
27 "bar", | |
28 "1.2.3", | |
29 contents: [d.dir("lib", [d.file("bar.dart", "final message = 'hello!';
")])]); | |
30 }); | |
31 | |
32 d.appDir({ | |
33 "foo": "any" | |
34 }).create(); | |
35 | |
36 pubGet(output: contains("Precompiled foo:hello.")); | |
37 | |
38 d.dir( | |
39 p.join(appPath, '.pub', 'bin', 'foo'), | |
40 [d.matcherFile('hello.dart.snapshot', contains('hello!'))]).validate(); | |
41 | |
42 servePackages((builder) { | |
43 builder.serve( | |
44 "bar", | |
45 "1.2.4", | |
46 contents: [d.dir("lib", [d.file("bar.dart", "final message = 'hello 2!
';")]),]); | |
47 }); | |
48 | |
49 pubUpgrade(output: contains("Precompiled foo:hello.")); | |
50 | |
51 d.dir( | |
52 p.join(appPath, '.pub', 'bin', 'foo'), | |
53 [d.matcherFile('hello.dart.snapshot', contains('hello 2!'))]).validate()
; | |
54 | |
55 var process = pubRun(args: ['foo:hello']); | |
56 process.stdout.expect("hello 2!"); | |
57 process.shouldExit(); | |
58 }); | |
59 } | |
OLD | NEW |