OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, 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 'package:path/path.dart' as path; | |
6 import 'package:scheduled_test/scheduled_test.dart'; | |
7 import 'package:unittest/unittest.dart'; | |
8 | |
9 import '../../../lib/src/lock_file.dart'; | |
10 import '../../../lib/src/source_registry.dart'; | |
11 import '../../descriptor.dart' as d; | |
12 import '../../test_pub.dart'; | |
13 | |
14 main() { | |
15 initConfig(); | |
16 integration("can use relative path", () { | |
17 d.dir("foo", [ | |
18 d.libDir("foo"), | |
19 d.libPubspec("foo", "0.0.1") | |
20 ]).create(); | |
21 | |
22 d.dir(appPath, [ | |
23 d.appPubspec({ | |
24 "foo": {"path": "../foo"} | |
25 }) | |
26 ]).create(); | |
27 | |
28 pubGet(); | |
29 | |
30 d.dir(packagesPath, [ | |
31 d.dir("foo", [ | |
32 d.file("foo.dart", 'main() => "foo";') | |
33 ]) | |
34 ]).validate(); | |
35 }); | |
36 | |
37 integration("path is relative to containing d.pubspec", () { | |
38 d.dir("relative", [ | |
39 d.dir("foo", [ | |
40 d.libDir("foo"), | |
41 d.libPubspec("foo", "0.0.1", deps: { | |
42 "bar": {"path": "../bar"} | |
43 }) | |
44 ]), | |
45 d.dir("bar", [ | |
46 d.libDir("bar"), | |
47 d.libPubspec("bar", "0.0.1") | |
48 ]) | |
49 ]).create(); | |
50 | |
51 d.dir(appPath, [ | |
52 d.appPubspec({ | |
53 "foo": {"path": "../relative/foo"} | |
54 }) | |
55 ]).create(); | |
56 | |
57 pubGet(); | |
58 | |
59 d.dir(packagesPath, [ | |
60 d.dir("foo", [ | |
61 d.file("foo.dart", 'main() => "foo";') | |
62 ]), | |
63 d.dir("bar", [ | |
64 d.file("bar.dart", 'main() => "bar";') | |
65 ]) | |
66 ]).validate(); | |
67 }); | |
68 | |
69 integration("relative path preserved in the lockfile", () { | |
70 d.dir("foo", [ | |
71 d.libDir("foo"), | |
72 d.libPubspec("foo", "0.0.1") | |
73 ]).create(); | |
74 | |
75 d.dir(appPath, [ | |
76 d.appPubspec({ | |
77 "foo": {"path": "../foo"} | |
78 }) | |
79 ]).create(); | |
80 | |
81 pubGet(); | |
82 | |
83 schedule(() { | |
84 var lockfilePath = path.join(sandboxDir, appPath, "pubspec.lock"); | |
85 var lockfile = new LockFile.load(lockfilePath, new SourceRegistry()); | |
86 var description = lockfile.packages["foo"].description; | |
87 | |
88 expect(path.isRelative(description["path"]), isTrue); | |
89 }); | |
90 }); | |
91 } | |
OLD | NEW |