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 import 'package:path/path.dart' as p; | 5 import 'package:path/path.dart' as p; |
6 import 'package:scheduled_test/scheduled_test.dart'; | 6 import 'package:scheduled_test/scheduled_test.dart'; |
7 | 7 |
8 import '../descriptor.dart' as d; | 8 import '../descriptor.dart' as d; |
9 import '../test_pub.dart'; | 9 import '../test_pub.dart'; |
10 | 10 |
11 main() { | 11 main() { |
12 integration("upgrades a snapshot when its package is upgraded", () { | 12 integration("upgrades a snapshot when its package is upgraded", () { |
13 servePackages((builder) { | 13 servePackages((builder) { |
14 builder.serve("foo", "1.2.3", contents: [ | 14 builder.serve("foo", "1.2.3", contents: [ |
15 d.dir("bin", [ | 15 d.dir("bin", [ |
16 d.file("hello.dart", "void main() => print('hello!');") | 16 d.file("hello.dart", "void main() => print('hello!');") |
17 ]) | 17 ]) |
18 ]); | 18 ]); |
19 }); | 19 }); |
20 | 20 |
21 d.appDir({"foo": "any"}).create(); | 21 d.appDir({"foo": "any"}).create(); |
22 | 22 |
23 pubGet(output: contains("Precompiled foo:hello.")); | 23 pubGet(output: contains("Precompiled foo:hello.")); |
24 | 24 |
25 d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [ | 25 d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [ |
26 d.matcherFile('hello.dart.snapshot', contains('hello!')) | 26 d.matcherFile('hello.dart.snapshot', contains('hello!')) |
27 ]).validate(); | 27 ]).validate(); |
28 | 28 |
29 servePackages((builder) { | 29 globalPackageServer.add((builder) { |
30 builder.serve("foo", "1.2.4", contents: [ | 30 builder.serve("foo", "1.2.4", contents: [ |
31 d.dir("bin", [ | 31 d.dir("bin", [ |
32 d.file("hello.dart", "void main() => print('hello 2!');") | 32 d.file("hello.dart", "void main() => print('hello 2!');") |
33 ]) | 33 ]) |
34 ]); | 34 ]); |
35 }); | 35 }); |
36 | 36 |
37 pubUpgrade(output: contains("Precompiled foo:hello.")); | 37 pubUpgrade(output: contains("Precompiled foo:hello.")); |
38 | 38 |
39 d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [ | 39 d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [ |
40 d.matcherFile('hello.dart.snapshot', contains('hello 2!')) | 40 d.matcherFile('hello.dart.snapshot', contains('hello 2!')) |
41 ]).validate(); | 41 ]).validate(); |
42 | 42 |
43 var process = pubRun(args: ['foo:hello']); | 43 var process = pubRun(args: ['foo:hello']); |
44 process.stdout.expect("hello 2!"); | 44 process.stdout.expect("hello 2!"); |
45 process.shouldExit(); | 45 process.shouldExit(); |
46 }); | 46 }); |
47 } | 47 } |
OLD | NEW |