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", [d.libDir("foo"), d.libPubspec("foo", "0.0.1")]).create(); | |
18 | |
19 d.dir(appPath, [d.appPubspec({ | |
20 "foo": { | |
21 "path": "../foo" | |
22 } | |
23 })]).create(); | |
24 | |
25 pubGet(); | |
26 | |
27 d.dir( | |
28 packagesPath, | |
29 [d.dir("foo", [d.file("foo.dart", 'main() => "foo";')])]).validate(); | |
30 }); | |
31 | |
32 integration("path is relative to containing d.pubspec", () { | |
33 d.dir( | |
34 "relative", | |
35 [d.dir("foo", [d.libDir("foo"), d.libPubspec("foo", "0.0.1", deps: { | |
36 "bar": { | |
37 "path": "../bar" | |
38 } | |
39 })]), | |
40 d.dir("bar", [d.libDir("bar"), d.libPubspec("bar", "0.0.1")])]).crea
te(); | |
41 | |
42 d.dir(appPath, [d.appPubspec({ | |
43 "foo": { | |
44 "path": "../relative/foo" | |
45 } | |
46 })]).create(); | |
47 | |
48 pubGet(); | |
49 | |
50 d.dir( | |
51 packagesPath, | |
52 [ | |
53 d.dir("foo", [d.file("foo.dart", 'main() => "foo";')]), | |
54 d.dir("bar", [d.file("bar.dart", 'main() => "bar";')])]).validate(); | |
55 }); | |
56 | |
57 integration("relative path preserved in the lockfile", () { | |
58 d.dir("foo", [d.libDir("foo"), d.libPubspec("foo", "0.0.1")]).create(); | |
59 | |
60 d.dir(appPath, [d.appPubspec({ | |
61 "foo": { | |
62 "path": "../foo" | |
63 } | |
64 })]).create(); | |
65 | |
66 pubGet(); | |
67 | |
68 schedule(() { | |
69 var lockfilePath = path.join(sandboxDir, appPath, "pubspec.lock"); | |
70 var lockfile = new LockFile.load(lockfilePath, new SourceRegistry()); | |
71 var description = lockfile.packages["foo"].description; | |
72 | |
73 expect(path.isRelative(description["path"]), isTrue); | |
74 }); | |
75 }); | |
76 } | |
OLD | NEW |