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