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 |
5 import '../../../../pub/exit_codes.dart' as exit_codes; | 7 import '../../../../pub/exit_codes.dart' as exit_codes; |
6 import '../../test_pub.dart'; | 8 import '../../test_pub.dart'; |
7 | 9 |
8 main() { | 10 main() { |
9 initConfig(); | 11 initConfig(); |
10 integration('path dependencies cannot use relative paths', () { | 12 integration("can use relative path", () { |
| 13 dir("foo", [ |
| 14 libDir("foo"), |
| 15 libPubspec("foo", "0.0.1") |
| 16 ]).scheduleCreate(); |
| 17 |
11 dir(appPath, [ | 18 dir(appPath, [ |
12 pubspec({ | 19 pubspec({ |
13 "name": "myapp", | 20 "name": "myapp", |
14 "dependencies": { | 21 "dependencies": { |
15 "foo": {"path": "../foo"} | 22 "foo": {"path": "../foo"} |
16 } | 23 } |
17 }) | 24 }) |
18 ]).scheduleCreate(); | 25 ]).scheduleCreate(); |
19 | 26 |
20 schedulePub(args: ['install'], | 27 schedulePub(args: ["install"], |
21 error: new RegExp("Path dependency for package 'foo' must be an " | 28 output: new RegExp(r"Dependencies installed!$")); |
22 "absolute path. Was '../foo'."), | 29 |
23 exitCode: exit_codes.DATA); | 30 dir(packagesPath, [ |
| 31 dir("foo", [ |
| 32 file("foo.dart", 'main() => "foo";') |
| 33 ]) |
| 34 ]).scheduleValidate(); |
24 }); | 35 }); |
25 } | 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 }); |
| 72 } |
OLD | NEW |