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/path/lib/path.dart' as path; | |
6 | |
7 import '../../../../pub/exit_codes.dart' as exit_codes; | 5 import '../../../../pub/exit_codes.dart' as exit_codes; |
8 import '../../test_pub.dart'; | 6 import '../../test_pub.dart'; |
9 | 7 |
10 main() { | 8 main() { |
11 initConfig(); | 9 initConfig(); |
12 integration("can use relative path", () { | 10 integration('path dependencies cannot use relative paths', () { |
13 dir("foo", [ | |
14 libDir("foo"), | |
15 libPubspec("foo", "0.0.1") | |
16 ]).scheduleCreate(); | |
17 | |
18 dir(appPath, [ | 11 dir(appPath, [ |
19 pubspec({ | 12 pubspec({ |
20 "name": "myapp", | 13 "name": "myapp", |
21 "dependencies": { | 14 "dependencies": { |
22 "foo": {"path": "../foo"} | 15 "foo": {"path": "../foo"} |
23 } | 16 } |
24 }) | 17 }) |
25 ]).scheduleCreate(); | 18 ]).scheduleCreate(); |
26 | 19 |
27 schedulePub(args: ["install"], | 20 schedulePub(args: ['install'], |
28 output: new RegExp(r"Dependencies installed!$")); | 21 error: new RegExp("Path dependency for package 'foo' must be an " |
29 | 22 "absolute path. Was '../foo'."), |
30 dir(packagesPath, [ | 23 exitCode: exit_codes.DATA); |
31 dir("foo", [ | |
32 file("foo.dart", 'main() => "foo";') | |
33 ]) | |
34 ]).scheduleValidate(); | |
35 }); | |
36 | |
37 integration("path is relative to containing pubspec", () { | |
38 dir("relative", [ | |
39 dir("foo", [ | |
40 libDir("foo"), | |
41 libPubspec("foo", "0.0.1", deps: [ | |
42 {"path": "../bar"} | |
43 ]) | |
44 ]), | |
45 dir("bar", [ | |
46 libDir("bar"), | |
47 libPubspec("bar", "0.0.1") | |
48 ]) | |
49 ]).scheduleCreate(); | |
50 | |
51 dir(appPath, [ | |
52 pubspec({ | |
53 "name": "myapp", | |
54 "dependencies": { | |
55 "foo": {"path": "../relative/foo"} | |
56 } | |
57 }) | |
58 ]).scheduleCreate(); | |
59 | |
60 schedulePub(args: ["install"], | |
61 output: new RegExp(r"Dependencies installed!$")); | |
62 | |
63 dir(packagesPath, [ | |
64 dir("foo", [ | |
65 file("foo.dart", 'main() => "foo";') | |
66 ]), | |
67 dir("bar", [ | |
68 file("bar.dart", 'main() => "bar";') | |
69 ]) | |
70 ]).scheduleValidate(); | |
71 }); | 24 }); |
72 } | 25 } |
OLD | NEW |