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

Side by Side Diff: sdk/lib/_internal/pub/test/version_solver_test.dart

Issue 13952013: Create a "PackageRef" class that defines a versionless package reference. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/validator/dependency.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library pub_update_test; 5 library pub_update_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 _packages.putIfAbsent(description, () => new Map<Version, Package>()); 933 _packages.putIfAbsent(description, () => new Map<Version, Package>());
934 _packages[description][package.version] = package; 934 _packages[description][package.version] = package;
935 } 935 }
936 } 936 }
937 937
938 Package mockPackage(String description, String version, 938 Package mockPackage(String description, String version,
939 Map dependencyStrings) { 939 Map dependencyStrings) {
940 var sdkConstraint = null; 940 var sdkConstraint = null;
941 941
942 // Build the pubspec dependencies. 942 // Build the pubspec dependencies.
943 var dependencies = <PackageRef>[]; 943 var dependencies = <PackageDep>[];
944 var devDependencies = <PackageRef>[]; 944 var devDependencies = <PackageDep>[];
945 945
946 dependencyStrings.forEach((name, constraint) { 946 dependencyStrings.forEach((name, constraint) {
947 parseSource(name, (isDev, name, source) { 947 parseSource(name, (isDev, name, source) {
948 var packageName = name.replaceFirst(new RegExp(r"-[^-]+$"), ""); 948 var packageName = name.replaceFirst(new RegExp(r"-[^-]+$"), "");
949 constraint = new VersionConstraint.parse(constraint); 949 constraint = new VersionConstraint.parse(constraint);
950 950
951 if (name == 'sdk') { 951 if (name == 'sdk') {
952 sdkConstraint = constraint; 952 sdkConstraint = constraint;
953 return; 953 return;
954 } 954 }
955 955
956 var ref = new PackageRef(packageName, source, constraint, name); 956 var dep = new PackageDep(packageName, source, constraint, name);
957 957
958 if (isDev) { 958 if (isDev) {
959 devDependencies.add(ref); 959 devDependencies.add(dep);
960 } else { 960 } else {
961 dependencies.add(ref); 961 dependencies.add(dep);
962 } 962 }
963 }); 963 });
964 }); 964 });
965 965
966 var name = description.replaceFirst(new RegExp(r"-[^-]+$"), ""); 966 var name = description.replaceFirst(new RegExp(r"-[^-]+$"), "");
967 var pubspec = new Pubspec( 967 var pubspec = new Pubspec(
968 name, new Version.parse(version), dependencies, devDependencies, 968 name, new Version.parse(version), dependencies, devDependencies,
969 new PubspecEnvironment(sdkConstraint)); 969 new PubspecEnvironment(sdkConstraint));
970 return new Package.inMemory(pubspec); 970 return new Package.inMemory(pubspec);
971 } 971 }
(...skipping 17 matching lines...) Expand all
989 }; 989 };
990 990
991 var match = new RegExp(r"(.*) from (.*)").firstMatch(description); 991 var match = new RegExp(r"(.*) from (.*)").firstMatch(description);
992 if (match != null) { 992 if (match != null) {
993 name = match[1]; 993 name = match[1];
994 source = sourceNames[match[2]]; 994 source = sourceNames[match[2]];
995 } 995 }
996 996
997 callback(isDev, name, source); 997 callback(isDev, name, source);
998 } 998 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/validator/dependency.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698