added nextMinor, nextMajor, nextPatch

This commit is contained in:
Enrique García Cota
2012-01-14 01:08:19 +01:00
parent 1e00a63eae
commit 2b1dc60390
2 changed files with 53 additions and 16 deletions

View File

@@ -101,4 +101,27 @@ context('semver', function()
end)
end)
describe("nextPatch", function()
it("increases the patch number by 1", function()
assert_equal(v'1.0.1', v'1.0.0':nextPatch())
end)
end)
describe("nextMinor", function()
it("increases the minor number by 1", function()
assert_equal(v'1.2.0', v'1.1.0':nextMinor())
end)
it("resets the patch number", function()
assert_equal(v'1.2.0', v'1.1.7':nextMinor())
end)
end)
describe("nextMajor", function()
it("increases the major number by 1", function()
assert_equal(v'2.0.0', v'1.0.0':nextMajor())
end)
it("resets the patch number", function()
assert_equal(v'2.0.0', v'1.2.3':nextMajor())
end)
end)
end)