OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 '../../../../../pkg/pathos/lib/path.dart' as path; | 5 import '../../../../../pkg/pathos/lib/path.dart' as path; |
6 | 6 |
7 import '../../../../pub/exit_codes.dart' as exit_codes; | |
8 import '../../test_pub.dart'; | 7 import '../../test_pub.dart'; |
9 | 8 |
10 main() { | 9 main() { |
11 initConfig(); | 10 initConfig(); |
12 integration("can use relative path", () { | 11 integration("shared dependency with same path", () { |
12 dir("shared", [ | |
13 libDir("shared"), | |
14 libPubspec("shared", "0.0.1") | |
15 ]).scheduleCreate(); | |
16 | |
13 dir("foo", [ | 17 dir("foo", [ |
14 libDir("foo"), | 18 libDir("foo"), |
15 libPubspec("foo", "0.0.1") | 19 libPubspec("foo", "0.0.1", deps: [ |
20 {"path": "../shared"} | |
21 ]) | |
22 ]).scheduleCreate(); | |
23 | |
24 dir("bar", [ | |
25 libDir("bar"), | |
26 libPubspec("bar", "0.0.1", deps: [ | |
27 {"path": "../shared"} | |
28 ]) | |
16 ]).scheduleCreate(); | 29 ]).scheduleCreate(); |
17 | 30 |
18 dir(appPath, [ | 31 dir(appPath, [ |
19 pubspec({ | 32 pubspec({ |
20 "name": "myapp", | 33 "name": "myapp", |
21 "dependencies": { | 34 "dependencies": { |
22 "foo": {"path": "../foo"} | 35 "foo": {"path": "../foo"}, |
36 "bar": {"path": "../bar"} | |
23 } | 37 } |
24 }) | 38 }) |
25 ]).scheduleCreate(); | 39 ]).scheduleCreate(); |
26 | 40 |
27 schedulePub(args: ["install"], | 41 schedulePub(args: ["install"], |
28 output: new RegExp(r"Dependencies installed!$")); | 42 output: new RegExp(r"Dependencies installed!$")); |
29 | 43 |
30 dir(packagesPath, [ | 44 dir(packagesPath, [ |
31 dir("foo", [ | 45 dir("foo", [ |
32 file("foo.dart", 'main() => "foo";') | 46 file("foo.dart", 'main() => "foo";') |
47 ]), | |
48 dir("bar", [ | |
49 file("bar.dart", 'main() => "bar";') | |
50 ]), | |
51 dir("shared", [ | |
52 file("shared.dart", 'main() => "shared";') | |
33 ]) | 53 ]) |
34 ]).scheduleValidate(); | 54 ]).scheduleValidate(); |
35 }); | 55 }); |
36 | 56 |
37 integration("path is relative to containing pubspec", () { | 57 integration("shared dependency with paths that normalize the same", () { |
38 dir("relative", [ | 58 dir("shared", [ |
39 dir("foo", [ | 59 libDir("shared"), |
40 libDir("foo"), | 60 libPubspec("shared", "0.0.1") |
41 libPubspec("foo", "0.0.1", deps: [ | 61 ]).scheduleCreate(); |
42 {"path": "../bar"} | 62 |
43 ]) | 63 dir("foo", [ |
44 ]), | 64 libDir("foo"), |
45 dir("bar", [ | 65 libPubspec("foo", "0.0.1", deps: [ |
46 libDir("bar"), | 66 {"path": "../shared"} |
47 libPubspec("bar", "0.0.1") | |
48 ]) | 67 ]) |
49 ]).scheduleCreate(); | 68 ]).scheduleCreate(); |
50 | 69 |
70 dir("bar", [ | |
71 libDir("bar"), | |
72 libPubspec("bar", "0.0.1", deps: [ | |
73 {"path": "../././shared"} | |
74 ]) | |
75 ]).scheduleCreate(); | |
76 | |
51 dir(appPath, [ | 77 dir(appPath, [ |
52 pubspec({ | 78 pubspec({ |
53 "name": "myapp", | 79 "name": "myapp", |
54 "dependencies": { | 80 "dependencies": { |
55 "foo": {"path": "../relative/foo"} | 81 "foo": {"path": "../foo"}, |
82 "bar": {"path": "../bar"} | |
56 } | 83 } |
57 }) | 84 }) |
58 ]).scheduleCreate(); | 85 ]).scheduleCreate(); |
59 | 86 |
60 schedulePub(args: ["install"], | 87 schedulePub(args: ["install"], |
61 output: new RegExp(r"Dependencies installed!$")); | 88 output: new RegExp(r"Dependencies installed!$")); |
62 | 89 |
63 dir(packagesPath, [ | 90 dir(packagesPath, [ |
64 dir("foo", [ | 91 dir("foo", [ |
65 file("foo.dart", 'main() => "foo";') | 92 file("foo.dart", 'main() => "foo";') |
66 ]), | 93 ]), |
67 dir("bar", [ | 94 dir("bar", [ |
68 file("bar.dart", 'main() => "bar";') | 95 file("bar.dart", 'main() => "bar";') |
96 ]), | |
97 dir("shared", [ | |
98 file("shared.dart", 'main() => "shared";') | |
69 ]) | 99 ]) |
70 ]).scheduleValidate(); | 100 ]).scheduleValidate(); |
71 }); | 101 }); |
72 } | 102 } |
nweiz
2013/02/25 22:08:46
Test that an absolute path and a relative path tha
Bob Nystrom
2013/02/25 22:50:26
Done.
| |
OLD | NEW |