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

Side by Side Diff: utils/tests/pub/version_solver_test.dart

Issue 10701146: Make VersionSolver actually return PackageIds. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Style change Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/version_solver.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:io'); 7 #import('dart:io');
8 #import('dart:isolate'); 8 #import('dart:isolate');
9 9
10 #import('../../pub/package.dart'); 10 #import('../../pub/package.dart');
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 if (result != null) { 263 if (result != null) {
264 result.forEach((name, version) { 264 result.forEach((name, version) {
265 result[name] = new Version.parse(version); 265 result[name] = new Version.parse(version);
266 }); 266 });
267 } 267 }
268 268
269 // Resolve the versions. 269 // Resolve the versions.
270 var future = resolveVersions(sources, root); 270 var future = resolveVersions(sources, root);
271 271
272 if (result != null) { 272 if (result != null) {
273 expect(future, completion(equals(result))); 273 expect(future, completion(predicate((actualResult) {
274 for (var id in actualResult) {
275 if (!result.containsKey(id.description)) return false;
276 if (id.version != result.remove(id.description)) return false;
277 }
278 if (!result.isEmpty()) return false;
279 return true;
Bob Nystrom 2012/07/11 22:51:02 return result.isEmpty();
nweiz 2012/07/11 22:55:40 Done.
280 }, description: 'packages to match $result')));
274 } else if (error == noVersion) { 281 } else if (error == noVersion) {
275 expect(future, throwsA(new isInstanceOf<NoVersionException>())); 282 expect(future, throwsA(new isInstanceOf<NoVersionException>()));
276 } else if (error == disjointConstraint) { 283 } else if (error == disjointConstraint) {
277 expect(future, throwsA(new isInstanceOf<DisjointConstraintException>())); 284 expect(future, throwsA(new isInstanceOf<DisjointConstraintException>()));
278 } else if (error == sourceMismatch) { 285 } else if (error == sourceMismatch) {
279 expect(future, throwsA(new isInstanceOf<SourceMismatchException>())); 286 expect(future, throwsA(new isInstanceOf<SourceMismatchException>()));
280 } else if (error == descriptionMismatch) { 287 } else if (error == descriptionMismatch) {
281 expect(future, throwsA(new isInstanceOf<DescriptionMismatchException>())); 288 expect(future, throwsA(new isInstanceOf<DescriptionMismatchException>()));
282 } else if (error == couldNotSolve) { 289 } else if (error == couldNotSolve) {
283 expect(future, throwsA(new isInstanceOf<CouldNotSolveException>())); 290 expect(future, throwsA(new isInstanceOf<CouldNotSolveException>()));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 Pair<String, Source> parseSource(String name) { 395 Pair<String, Source> parseSource(String name) {
389 var match = new RegExp(@"(.*) from (.*)").firstMatch(name); 396 var match = new RegExp(@"(.*) from (.*)").firstMatch(name);
390 if (match == null) return new Pair<String, Source>(name, source1); 397 if (match == null) return new Pair<String, Source>(name, source1);
391 switch (match[2]) { 398 switch (match[2]) {
392 case 'mock1': return new Pair<String, Source>(match[1], source1); 399 case 'mock1': return new Pair<String, Source>(match[1], source1);
393 case 'mock2': return new Pair<String, Source>(match[1], source2); 400 case 'mock2': return new Pair<String, Source>(match[1], source2);
394 case 'versionless': 401 case 'versionless':
395 return new Pair<String, Source>(match[1], versionlessSource); 402 return new Pair<String, Source>(match[1], versionlessSource);
396 } 403 }
397 } 404 }
OLDNEW
« no previous file with comments | « utils/pub/version_solver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698