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

Unified Diff: utils/tests/pub/pubspec_test.dart

Issue 10540151: First pass at version constraint solver. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Request all versions from the source, and not just the best. Created 8 years, 6 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 | « utils/pub/version_solver.dart ('k') | utils/tests/pub/version_solver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/pubspec_test.dart
diff --git a/utils/tests/pub/pubspec_test.dart b/utils/tests/pub/pubspec_test.dart
index ba0a04ce0204ab197e120db17ce96fecc12b2e21..134a450fe8bf3232b466faa7aab4cb9ac7a61bcb 100644
--- a/utils/tests/pub/pubspec_test.dart
+++ b/utils/tests/pub/pubspec_test.dart
@@ -9,6 +9,7 @@
#import('../../pub/source.dart');
#import('../../pub/source_registry.dart');
#import('../../pub/utils.dart');
+#import('../../pub/version.dart');
class MockSource extends Source {
final String name = "mock";
@@ -21,6 +22,24 @@ class MockSource extends Source {
main() {
group('Pubspec', () {
group('parse()', () {
+ test("allows a version constraint for dependencies", () {
+ var sources = new SourceRegistry();
+ sources.register(new MockSource());
+
+ var pubspec = new Pubspec.parse('''
+dependencies:
+ foo:
+ mock: ok
+ version: ">=1.2.3 <3.4.5"
+''', sources);
+
+ var foo = pubspec.dependencies[0];
+ expect(foo.name, equals('foo'));
+ expect(foo.constraint.allows(new Version(1, 2, 3)));
+ expect(foo.constraint.allows(new Version(1, 2, 5)));
+ expect(!foo.constraint.allows(new Version(3, 4, 5)));
+ });
+
test("throws if the description isn't valid", () {
var sources = new SourceRegistry();
sources.register(new MockSource());
« no previous file with comments | « utils/pub/version_solver.dart ('k') | utils/tests/pub/version_solver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698