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

Unified Diff: sdk/lib/_internal/pub/test/test_pub.dart

Issue 19592015: Get rid of hokey dependencyMapList stuff. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « sdk/lib/_internal/pub/test/pub_cache_test.dart ('k') | sdk/lib/_internal/pub/test/unknown_source_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/test/test_pub.dart
diff --git a/sdk/lib/_internal/pub/test/test_pub.dart b/sdk/lib/_internal/pub/test/test_pub.dart
index 5d1afcfd17fb1b7ca35ac96e14068d3dde17a381..db454a082416c305ea5a1bc4d46d5d9b9b6d5ac5 100644
--- a/sdk/lib/_internal/pub/test/test_pub.dart
+++ b/sdk/lib/_internal/pub/test/test_pub.dart
@@ -607,7 +607,7 @@ void useMockClient(MockClient client) {
/// Describes a map representing a library package with the given [name],
/// [version], and [dependencies].
-Map packageMap(String name, String version, [List dependencies]) {
+Map packageMap(String name, String version, [Map dependencies]) {
var package = {
"name": name,
"version": version,
@@ -615,54 +615,10 @@ Map packageMap(String name, String version, [List dependencies]) {
"homepage": "http://pub.dartlang.org",
"description": "A package, I guess."
};
- if (dependencies != null) {
- package["dependencies"] = dependencyListToMap(dependencies);
- }
- return package;
-}
-/// Describes a map representing a dependency on a package in the package
-/// repository.
-Map dependencyMap(String name, [String versionConstraint]) {
- var dependency = {"hosted": name};
- if (versionConstraint != null) dependency["version"] = versionConstraint;
- return dependency;
-}
-
-/// Converts a list of dependencies as passed to [package] into a hash as used
-/// in a pubspec.
-Future<Map> dependencyListToMap(List<Map> dependencies) {
- return awaitObject(dependencies).then((resolvedDependencies) {
- var result = <String, Map>{};
- for (var dependency in resolvedDependencies) {
- var keys = dependency.keys.where((key) => key != "version");
- var sourceName = only(keys);
+ if (dependencies != null) package["dependencies"] = dependencies;
- 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'];
- // TODO(rnystrom): Using path.basename on a URL is hacky. If we add URL
- // support to pkg/path, should use an explicit builder for that.
- return path.basename(url.replaceFirst(new RegExp(r"(\.git)?/?$"), ""));
- case "hosted":
- if (description is String) return description;
- return description['name'];
- case "path":
- return path.basename(description);
- case "sdk":
- return description;
- default:
- return description;
- }
+ return package;
}
/// Returns a Map in the format used by the pub.dartlang.org API to represent a
« no previous file with comments | « sdk/lib/_internal/pub/test/pub_cache_test.dart ('k') | sdk/lib/_internal/pub/test/unknown_source_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698