| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |