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

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

Issue 12038038: Add support for specifying SDK version constraints in pubspecs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up a bit. Created 7 years, 11 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/tests/pub/pubspec_test.dart ('k') | utils/tests/pub/version_test.dart » ('j') | 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 '../../pub/lock_file.dart'; 10 import '../../pub/lock_file.dart';
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 var dependencies = <PackageRef>[]; 488 var dependencies = <PackageRef>[];
489 dependencyStrings.forEach((name, constraint) { 489 dependencyStrings.forEach((name, constraint) {
490 var parsed = parseSource(name); 490 var parsed = parseSource(name);
491 var description = parsed.first; 491 var description = parsed.first;
492 var packageName = description.replaceFirst(new RegExp(r"-[^-]+$"), ""); 492 var packageName = description.replaceFirst(new RegExp(r"-[^-]+$"), "");
493 dependencies.add(new PackageRef(packageName, parsed.last, 493 dependencies.add(new PackageRef(packageName, parsed.last,
494 new VersionConstraint.parse(constraint), description)); 494 new VersionConstraint.parse(constraint), description));
495 }); 495 });
496 496
497 var pubspec = new Pubspec( 497 var pubspec = new Pubspec(
498 description, new Version.parse(version), dependencies); 498 description, new Version.parse(version), dependencies,
499 new PubspecEnvironment());
499 return new Package.inMemory(pubspec); 500 return new Package.inMemory(pubspec);
500 } 501 }
501 502
502 void addPackage(Package package) { 503 void addPackage(Package package) {
503 _packages.putIfAbsent(package.name, () => new Map<Version, Package>()); 504 _packages.putIfAbsent(package.name, () => new Map<Version, Package>());
504 _packages[package.name][package.version] = package; 505 _packages[package.name][package.version] = package;
505 } 506 }
506 } 507 }
507 508
508 /// A source used for testing that doesn't natively understand versioning, 509 /// A source used for testing that doesn't natively understand versioning,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 var match = new RegExp(r"(.*) from (.*)").firstMatch(name); 543 var match = new RegExp(r"(.*) from (.*)").firstMatch(name);
543 if (match == null) return new Pair<String, Source>(name, source1); 544 if (match == null) return new Pair<String, Source>(name, source1);
544 switch (match[2]) { 545 switch (match[2]) {
545 case 'mock1': return new Pair<String, Source>(match[1], source1); 546 case 'mock1': return new Pair<String, Source>(match[1], source1);
546 case 'mock2': return new Pair<String, Source>(match[1], source2); 547 case 'mock2': return new Pair<String, Source>(match[1], source2);
547 case 'root': return new Pair<String, Source>(match[1], rootSource); 548 case 'root': return new Pair<String, Source>(match[1], rootSource);
548 case 'versionless': 549 case 'versionless':
549 return new Pair<String, Source>(match[1], versionlessSource); 550 return new Pair<String, Source>(match[1], versionlessSource);
550 } 551 }
551 } 552 }
OLDNEW
« no previous file with comments | « utils/tests/pub/pubspec_test.dart ('k') | utils/tests/pub/version_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698