Index: utils/tests/pub/test_pub.dart |
diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart |
index d40fbec87941760d4e2070927e8c6e6497f9254d..b383dda9a3c4e47ceb2d210a634d72634fd52e63 100644 |
--- a/utils/tests/pub/test_pub.dart |
+++ b/utils/tests/pub/test_pub.dart |
@@ -397,12 +397,27 @@ Future<Map> _dependencyListToMap(List<Map> dependencies) { |
throw 'Unknown source "$sourceName"'; |
} |
- result[source.packageName(dependency[sourceName])] = dependency; |
+ result[_packageName(sourceName, dependency[sourceName])] = dependency; |
} |
return result; |
}); |
} |
+/// Return the name for the package described by [description] and from |
+/// [sourceName]. |
+String _packageName(String sourceName, description) { |
+ switch (sourceName) { |
+ case "git": |
+ var url = description is String ? description : description['url']; |
+ return basename(url.replaceFirst(const RegExp(@"(\.git)?/?$"), "")); |
+ case "hosted": |
+ if (description is String) return description; |
+ return description['name']; |
+ default: |
+ return description; |
+ } |
+} |
+ |
/** |
* The path of the package cache directory used for tests. Relative to the |
* sandbox directory. |