diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2014-10-17 08:28:53 +0400 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2014-10-17 08:28:53 +0400 |
commit | 9c1314985e513e20ffa3ea0ca333ba2ab78299c9 (patch) | |
tree | 7fe02fd29a5690d40234b73130f0fb179fb4e45b /node_modules/semver/test | |
parent | 4000e3333a76ca4844681efa8737cfac24b7c2c8 (diff) |
semver@4.1.0
More consistent prerelease handling.
Diffstat (limited to 'node_modules/semver/test')
-rw-r--r-- | node_modules/semver/test/clean.js | 6 | ||||
-rw-r--r-- | node_modules/semver/test/gtr.js | 2 | ||||
-rw-r--r-- | node_modules/semver/test/index.js | 66 |
3 files changed, 63 insertions, 11 deletions
diff --git a/node_modules/semver/test/clean.js b/node_modules/semver/test/clean.js index 1ab13e416..9e268de95 100644 --- a/node_modules/semver/test/clean.js +++ b/node_modules/semver/test/clean.js @@ -14,7 +14,11 @@ test('\nclean tests', function(t) { [' =v1.2.3 ', '1.2.3'], ['v1.2.3', '1.2.3'], [' v1.2.3 ', '1.2.3'], - ['\t1.2.3', '1.2.3'] + ['\t1.2.3', '1.2.3'], + ['>1.2.3', null], + ['~1.2.3', null], + ['<=1.2.3', null], + ['1.2.x', null] ].forEach(function(tuple) { var range = tuple[0]; var version = tuple[1]; diff --git a/node_modules/semver/test/gtr.js b/node_modules/semver/test/gtr.js index 8537fac0b..bbb87896c 100644 --- a/node_modules/semver/test/gtr.js +++ b/node_modules/semver/test/gtr.js @@ -66,7 +66,7 @@ test('\ngtr tests', function(t) { ['<1', '1.0.0beta', true], ['< 1', '1.0.0beta', true], ['=0.7.x', '0.8.2'], - ['<=0.7.x', '0.7.2'] + ['<0.7.x', '0.7.2'] ].forEach(function(tuple) { var range = tuple[0]; var version = tuple[1]; diff --git a/node_modules/semver/test/index.js b/node_modules/semver/test/index.js index 9f9a36d98..de8acaedf 100644 --- a/node_modules/semver/test/index.js +++ b/node_modules/semver/test/index.js @@ -201,6 +201,7 @@ test('\nrange tests', function(t) { ['~v0.5.4-pre', '0.5.5'], ['~v0.5.4-pre', '0.5.4'], ['=0.7.x', '0.7.2'], + ['<=0.7.x', '0.7.2'], ['>=0.7.x', '0.7.2'], ['<=0.7.x', '0.6.2'], ['~1.2.1 >=1.2.3', '1.2.3'], @@ -290,7 +291,7 @@ test('\nnegative range tests', function(t) { ['~v0.5.4-beta', '0.5.4-alpha'], ['=0.7.x', '0.8.2'], ['>=0.7.x', '0.6.2'], - ['<=0.7.x', '0.7.2'], + ['<0.7.x', '0.7.2'], ['<1.2.3', '1.2.3-beta'], ['=1.2.3', '1.2.3-beta'], ['>1.2', '1.2.8'], @@ -312,8 +313,8 @@ test('\nnegative range tests', function(t) { }); test('\nincrement versions test', function(t) { - // [version, inc, result] - // inc(version, inc) -> result +// [version, inc, result, identifier] +// inc(version, inc) -> result [['1.2.3', 'major', '2.0.0'], ['1.2.3', 'minor', '1.3.0'], ['1.2.3', 'patch', '1.2.4'], @@ -352,14 +353,59 @@ test('\nincrement versions test', function(t) { ['1.2.0', 'premajor', '2.0.0-0'], ['1.2.3-1', 'premajor', '2.0.0-0'], ['1.2.0-1', 'minor', '1.2.0'], - ['1.0.0-1', 'major', '1.0.0'] + ['1.0.0-1', 'major', '1.0.0'], + + ['1.2.3', 'major', '2.0.0', false, 'dev'], + ['1.2.3', 'minor', '1.3.0', false, 'dev'], + ['1.2.3', 'patch', '1.2.4', false, 'dev'], + ['1.2.3tag', 'major', '2.0.0', true, 'dev'], + ['1.2.3-tag', 'major', '2.0.0', false, 'dev'], + ['1.2.3', 'fake', null, false, 'dev'], + ['1.2.0-0', 'patch', '1.2.0', false, 'dev'], + ['fake', 'major', null, false, 'dev'], + ['1.2.3-4', 'major', '2.0.0', false, 'dev'], + ['1.2.3-4', 'minor', '1.3.0', false, 'dev'], + ['1.2.3-4', 'patch', '1.2.3', false, 'dev'], + ['1.2.3-alpha.0.beta', 'major', '2.0.0', false, 'dev'], + ['1.2.3-alpha.0.beta', 'minor', '1.3.0', false, 'dev'], + ['1.2.3-alpha.0.beta', 'patch', '1.2.3', false, 'dev'], + ['1.2.4', 'prerelease', '1.2.5-dev.0', false, 'dev'], + ['1.2.3-0', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.0', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1', false, 'alpha'], + ['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta', false, 'alpha'], + ['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta', false, 'alpha'], + ['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta', false, 'alpha'], + ['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta', false, 'alpha'], + ['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1', false, 'alpha'], + ['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2', false, 'alpha'], + ['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3', false, 'alpha'], + ['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta', false, 'alpha'], + ['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta', false, 'alpha'], + ['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta', false, 'alpha'], + ['1.2.0', 'prepatch', '1.2.1-dev.0', 'dev'], + ['1.2.0-1', 'prepatch', '1.2.1-dev.0', 'dev'], + ['1.2.0', 'preminor', '1.3.0-dev.0', 'dev'], + ['1.2.3-1', 'preminor', '1.3.0-dev.0', 'dev'], + ['1.2.0', 'premajor', '2.0.0-dev.0', 'dev'], + ['1.2.3-1', 'premajor', '2.0.0-dev.0', 'dev'], + ['1.2.0-1', 'minor', '1.2.0', 'dev'], + ['1.0.0-1', 'major', '1.0.0', 'dev'], + ['1.2.3-dev.bar', 'prerelease', '1.2.3-dev.0', false, 'dev'] + ].forEach(function(v) { var pre = v[0]; var what = v[1]; var wanted = v[2]; var loose = v[3]; - var found = inc(pre, what, loose); - t.equal(found, wanted, 'inc(' + pre + ', ' + what + ') === ' + wanted); + var id = v[4]; + var found = inc(pre, what, loose, id); + var cmd = 'inc(' + pre + ', ' + what + ', ' + id + ')'; + t.equal(found, wanted, cmd + ' === ' + wanted); }); t.end(); @@ -371,7 +417,7 @@ test('\nvalid range test', function(t) { // translate ranges into their canonical form [['1.0.0 - 2.0.0', '>=1.0.0 <=2.0.0'], ['1.0.0', '1.0.0'], - ['>=*', '>=0.0.0'], + ['>=*', '*'], ['', '*'], ['*', '*'], ['*', '*'], @@ -458,7 +504,7 @@ test('\ncomparators test', function(t) { // turn range into a set of individual comparators [['1.0.0 - 2.0.0', [['>=1.0.0', '<=2.0.0']]], ['1.0.0', [['1.0.0']]], - ['>=*', [['>=0.0.0']]], + ['>=*', [['']]], ['', [['']]], ['*', [['']]], ['*', [['']]], @@ -522,7 +568,9 @@ test('\ncomparators test', function(t) { ['1 2', [['>=1.0.0', '<2.0.0', '>=2.0.0', '<3.0.0']]], ['1.2 - 3.4.5', [['>=1.2.0', '<=3.4.5']]], ['1.2.3 - 3.4', [['>=1.2.3', '<3.5.0']]], - ['1.2.3 - 3', [['>=1.2.3', '<4.0.0']]] + ['1.2.3 - 3', [['>=1.2.3', '<4.0.0']]], + ['>*', [['<0.0.0']]], + ['<*', [['<0.0.0']]] ].forEach(function(v) { var pre = v[0]; var wanted = v[1]; |