OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS d.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 d.file. | |
4 | |
5 import 'descriptor.dart' as d; | |
6 import 'test_pub.dart'; | |
7 | |
8 main() { | |
9 initConfig(); | |
10 forBothPubGetAndUpgrade((command) { | |
11 integration('.packages file is created', () { | |
12 servePackages((builder) { | |
13 builder.serve("foo", "1.2.3", | |
14 deps: {'baz': '2.2.2'}, contents: [d.dir("lib", [])]); | |
15 builder.serve("bar", "3.2.1", contents: [d.dir("lib", [])]); | |
16 builder.serve("baz", "2.2.2", | |
17 deps: {"bar": "3.2.1"}, contents: [d.dir("lib", [])]); | |
18 }); | |
19 | |
20 d.appDir({"foo": "1.2.3"}).create(); | |
21 | |
22 pubCommand(command); | |
23 | |
24 d.dir(appPath, [d.packagesFile({ | |
25 "foo": "1.2.3", "bar": "3.2.1", "baz": "2.2.2", "myapp": "0.0.0"})]) | |
26 .validate(); | |
27 }); | |
28 | |
29 integration('.packages file is overwritten', () { | |
30 servePackages((builder) { | |
31 builder.serve("foo", "1.2.3", | |
32 deps: {'baz': '2.2.2'}, contents: [d.dir("lib", [])]); | |
33 builder.serve("bar", "3.2.1", contents: [d.dir("lib", [])]); | |
34 builder.serve("baz", "2.2.2", | |
35 deps: {"bar": "3.2.1"}, contents: [d.dir("lib", [])]); | |
36 }); | |
37 | |
38 d.appDir({"foo": "1.2.3"}).create(); | |
39 | |
40 var oldFile = d.dir(appPath, [d.packagesFile({"notFoo": "9.9.9"})]); | |
41 oldFile.create(); | |
42 oldFile.validate(); // Sanity-check that file was created correctly. | |
43 | |
44 pubCommand(command); | |
45 | |
46 d.dir(appPath, [d.packagesFile({ | |
47 "foo": "1.2.3", "bar": "3.2.1", "baz": "2.2.2", "myapp": "0.0.0"})]) | |
48 .validate(); | |
49 }); | |
50 | |
51 integration('.packages file is not created if pub command fails', () { | |
52 d.appDir({"foo": "1.2.3"}).create(); | |
53 | |
54 pubCommand(command, args: ['--offline'], | |
55 error: "Could not find package foo in cache.\n"); | |
56 | |
57 d.dir(appPath, [d.nothing('.packages')]).validate(); | |
58 }); | |
59 | |
60 integration('.packages file has relative path to path dependency', () { | |
61 servePackages((builder) { | |
62 builder.serve("foo", "1.2.3", | |
63 deps: {'baz': 'any'}, contents: [d.dir("lib", [])]); | |
64 builder.serve("baz", "9.9.9", | |
65 deps: {}, contents: [d.dir("lib", [])]); | |
66 }); | |
67 | |
nweiz
2015/06/23 19:56:43
Nit: extra newline
Lasse Reichstein Nielsen
2015/06/24 05:41:10
Done.
| |
68 | |
69 d.dir("local_baz", [ | |
70 d.libDir("baz", 'baz 3.2.1'), | |
71 d.libPubspec("baz", "3.2.1") | |
72 ]).create(); | |
73 | |
74 d.dir(appPath, [ | |
75 d.pubspec({ | |
76 "name": "myapp", | |
77 "dependencies": {}, | |
78 "dependency_overrides": { | |
79 "baz": {"path": "../local_baz"}, | |
80 } | |
81 }) | |
82 ]).create(); | |
83 | |
84 pubCommand(command); | |
85 | |
86 // Validate that we're using the path dependency version of stack_trace | |
87 // rather than the hosted version. | |
88 d.packagesDir({ | |
89 "baz": "3.2.1" | |
90 }).validate(); | |
nweiz
2015/06/23 19:56:43
We probably shouldn't be doing anything with the p
Lasse Reichstein Nielsen
2015/06/24 05:41:10
Done.
| |
91 | |
92 d.dir(appPath, [d.packagesFile({"myapp": "0.0.0", | |
93 "baz": "../local_baz"})]).validate(); | |
94 }); | |
95 | |
96 }); | |
97 } | |
OLD | NEW |