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

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

Issue 62103010: Properly handle leading zeros in pub version numbers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 7 years, 1 month 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/version.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 version_test; 5 library version_test;
6 6
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'test_pub.dart'; 8 import 'test_pub.dart';
9 import '../lib/src/version.dart'; 9 import '../lib/src/version.dart';
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 var b = new Version.parse(versions[j]); 73 var b = new Version.parse(versions[j]);
74 expect(a < b, equals(i < j)); 74 expect(a < b, equals(i < j));
75 expect(a > b, equals(i > j)); 75 expect(a > b, equals(i > j));
76 expect(a <= b, equals(i <= j)); 76 expect(a <= b, equals(i <= j));
77 expect(a >= b, equals(i >= j)); 77 expect(a >= b, equals(i >= j));
78 expect(a == b, equals(i == j)); 78 expect(a == b, equals(i == j));
79 expect(a != b, equals(i != j)); 79 expect(a != b, equals(i != j));
80 } 80 }
81 } 81 }
82 }); 82 });
83
84 test('equality', () {
85 expect(new Version.parse('01.2.3'), equals(new Version.parse('1.2.3')));
86 expect(new Version.parse('1.02.3'), equals(new Version.parse('1.2.3')));
87 expect(new Version.parse('1.2.03'), equals(new Version.parse('1.2.3')));
88 expect(new Version.parse('1.2.3-01'),
89 equals(new Version.parse('1.2.3-1')));
90 expect(new Version.parse('1.2.3+01'),
91 equals(new Version.parse('1.2.3+1')));
92 });
83 }); 93 });
84 94
85 test('allows()', () { 95 test('allows()', () {
86 expect(v123.allows(v123), isTrue); 96 expect(v123.allows(v123), isTrue);
87 expect(v123.allows(v114), isFalse); 97 expect(v123.allows(v114), isFalse);
88 expect(v123.allows(v124), isFalse); 98 expect(v123.allows(v124), isFalse);
89 }); 99 });
90 100
91 test('intersect()', () { 101 test('intersect()', () {
92 // Intersecting the same version returns the version. 102 // Intersecting the same version returns the version.
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 476
467 Matcher allows(List<Version> versions) => 477 Matcher allows(List<Version> versions) =>
468 new VersionConstraintMatcher(versions, true); 478 new VersionConstraintMatcher(versions, true);
469 479
470 Matcher doesNotAllow(List<Version> versions) => 480 Matcher doesNotAllow(List<Version> versions) =>
471 new VersionConstraintMatcher(versions, false); 481 new VersionConstraintMatcher(versions, false);
472 482
473 throwsIllegalArg(function) { 483 throwsIllegalArg(function) {
474 expect(function, throwsA((e) => e is ArgumentError)); 484 expect(function, throwsA((e) => e is ArgumentError));
475 } 485 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/version.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698