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