Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1727)

Unified Diff: test/descriptor/packages.dart

Issue 1225483003: Fix packages_file_test on OS X. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« test/descriptor.dart ('K') | « test/descriptor.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/descriptor/packages.dart
diff --git a/test/descriptor/packages.dart b/test/descriptor/packages.dart
index 5fbdb288436ea6ce077baf26eaaa061113854b3d..9d857c0671fadd13758effee3e7adffba1bc6e7a 100644
--- a/test/descriptor/packages.dart
+++ b/test/descriptor/packages.dart
@@ -23,14 +23,15 @@ class PackagesFileDescriptor extends Descriptor {
new RegExp(r"^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)"
r"(?:-[a-zA-Z\d-]+)?(?:\+[a-zA-Z\d-]+)?$");
- final _dependencies;
+ /// A map from package names to strings describing where the packages are
+ /// located on disk.
+ final Map<String, String> _dependencies;
/// Describes a `.packages` file with the given dependencies.
///
- /// Dependencies maps package name to semantic version.
- PackagesFileDescriptor([Map<String, String> dependencies])
- : _dependencies = dependencies,
- super('.packages');
+ /// [dependencies] maps package names to strings describing where the packages
+ /// are located on disk.
+ PackagesFileDescriptor([this._dependencies]) : super('.packages');
Future create([String parent]) => schedule(() {
if (parent == null) parent = defaultRoot;
@@ -45,7 +46,7 @@ class PackagesFileDescriptor extends Descriptor {
} else {
// Otherwise it's a path relative to the .pubspec file,
// which is also the relative path wrt. the .packages file.
- packagePath = version;
+ packagePath = p.fromUri(version);
}
mapping[package] = p.toUri(p.join(packagePath, "lib", ""));
});
@@ -80,19 +81,22 @@ class PackagesFileDescriptor extends Descriptor {
if (!map.containsKey(package)) {
fail(".packages does not contain $package entry");
}
- var version = _dependencies[package];
- if (_semverRE.hasMatch(version)) {
- if (!map[package].path.contains(version)) {
+
+ var description = _dependencies[package];
+ if (_semverRE.hasMatch(description)) {
+ if (!map[package].path.contains(description)) {
fail(".packages of $package has incorrect version. "
- "Expected $version, found location: ${map[package]}.");
+ "Expected $description, found location: ${map[package]}.");
}
} else {
- var packagePath = fileUri.resolve("$version/lib/");
- if (!packagePath.path.endsWith('/')) {
- packagePath = packagePath.replace(path: packagePath.path + '/');
- }
- if ("${map[package]}" != "$packagePath") {
- fail("Relative path: Expected $packagePath, found ${map[package]}");
+ var expected = p.normalize(p.join(
+ p.dirname(fullPath), p.fromUri(description), 'lib'));
+ expected = new File(expected).resolveSymbolicLinksSync();
+ var actual = new File(p.normalize(p.absolute(p.fromUri(map[package]))))
+ .resolveSymbolicLinksSync();
+
+ if (expected != actual) {
+ fail("Relative path: Expected $description, found ${map[package]}");
}
}
}
« test/descriptor.dart ('K') | « test/descriptor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698