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

Unified Diff: sdk/lib/_internal/pub/test/version_test.dart

Issue 105473002: Implicitly constrain barback to versions pub supports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years 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 | « sdk/lib/_internal/pub/test/test_pub.dart ('k') | tools/publish_barback.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/test/version_test.dart
diff --git a/sdk/lib/_internal/pub/test/version_test.dart b/sdk/lib/_internal/pub/test/version_test.dart
index f2c8c2c35303ffe20086ff886afeae5fec7a4471..0e7452a6524e2cf5db919df1b986e9084d3e4ff5 100644
--- a/sdk/lib/_internal/pub/test/version_test.dart
+++ b/sdk/lib/_internal/pub/test/version_test.dart
@@ -11,10 +11,13 @@ import '../lib/src/version.dart';
main() {
initConfig();
- final v123 = new Version.parse('1.2.3');
final v114 = new Version.parse('1.1.4');
+ final v123 = new Version.parse('1.2.3');
final v124 = new Version.parse('1.2.4');
+ final v130 = new Version.parse('1.3.0');
+ final v140 = new Version.parse('1.4.0');
final v200 = new Version.parse('2.0.0');
+ final v201 = new Version.parse('2.0.1');
final v234 = new Version.parse('2.3.4');
final v250 = new Version.parse('2.5.0');
final v300 = new Version.parse('3.0.0');
@@ -118,6 +121,46 @@ main() {
expect(v123.isEmpty, isFalse);
});
+ test('nextMajor', () {
+ expect(v123.nextMajor, equals(v200));
+ expect(v114.nextMajor, equals(v200));
+ expect(v200.nextMajor, equals(v300));
+
+ // Ignores pre-release if not on a major version.
+ expect(new Version.parse('1.2.3-dev').nextMajor, equals(v200));
+
+ // Just removes it if on a major version.
+ expect(new Version.parse('2.0.0-dev').nextMajor, equals(v200));
+
+ // Strips build suffix.
+ expect(new Version.parse('1.2.3+patch').nextMajor, equals(v200));
+ });
+
+ test('nextMinor', () {
+ expect(v123.nextMinor, equals(v130));
+ expect(v130.nextMinor, equals(v140));
+
+ // Ignores pre-release if not on a minor version.
+ expect(new Version.parse('1.2.3-dev').nextMinor, equals(v130));
+
+ // Just removes it if on a minor version.
+ expect(new Version.parse('1.3.0-dev').nextMinor, equals(v130));
+
+ // Strips build suffix.
+ expect(new Version.parse('1.2.3+patch').nextMinor, equals(v130));
+ });
+
+ test('nextPatch', () {
+ expect(v123.nextPatch, equals(v124));
+ expect(v200.nextPatch, equals(v201));
+
+ // Just removes pre-release version if present.
+ expect(new Version.parse('1.2.4-dev').nextPatch, equals(v124));
+
+ // Strips build suffix.
+ expect(new Version.parse('1.2.3+patch').nextPatch, equals(v124));
+ });
+
test('parse()', () {
expect(new Version.parse('0.0.0'), equals(new Version(0, 0, 0)));
expect(new Version.parse('12.34.56'), equals(new Version(12, 34, 56)));
« no previous file with comments | « sdk/lib/_internal/pub/test/test_pub.dart ('k') | tools/publish_barback.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698