Skip to content

Commit

Permalink
Fix jshint. Add tests to be doubly-sure about fuzzy-minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
crisptrutski committed Apr 9, 2015
1 parent 47a412f commit ab60739
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/semver.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function parseRange(range) {
}

// ^0.0 behaves like ~0.0
if (rangeObj.semver && rangeObj.major == 0 && !isNaN(rangeVersion.minor) && isNaN(rangeVersion.patch)) {
if (rangeObj.semver && rangeObj.major === 0 && !isNaN(rangeVersion.minor) && isNaN(rangeVersion.patch)) {
rangeObj.semver = false;
rangeObj.fuzzy = true;
}
Expand Down
5 changes: 4 additions & 1 deletion test/semver.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ suite('Fuzzy Compatibility Ranges', function() {
test('Basic compatibility', function() {
// project.showLogs = true;
// assert.equal(semver.match('^1.5.2', '1.4.0'), false);
assert.equal(semver.match('~1', '1.4.0'), true);
assert.equal(semver.match('~0', '0.1.0'), true);
assert.equal(semver.match('~0', '1.2.0'), false);
assert.equal(semver.match('~1', '1.2.0'), true);
assert.equal(semver.match('~1', '2.4.0'), false);
assert.equal(semver.match('~0.1', '0.1.0'), true);
assert.equal(semver.match('~0.1', '0.2.0'), false);
assert.equal(semver.match('~1.1', '1.2.0'), false);
Expand Down

0 comments on commit ab60739

Please sign in to comment.