finished with prereleases

This commit is contained in:
Enrique García Cota
2012-01-15 02:50:49 +01:00
parent 043c181c89
commit 0f826b8a39
2 changed files with 75 additions and 3 deletions

View File

@@ -118,7 +118,30 @@ context('semver', function()
assert_greater_than(v'0.0.2', v'0.0.1')
end)
describe("prereleases", function()
test("false if exact same prerelease", function()
assert_false(v'1.0.0-beta' < v'1.0.0-beta')
end)
test("a prerelease version is less than the official version", function()
assert_less_than(v'1.0.0-rc1', v'1.0.0')
end)
test("identifiers with only digits are compared numerically", function()
assert_less_than(v'1.0.0-1', v'1.0.0-2')
assert_less_than(v'1.0.0-2', v'1.0.0-10')
end)
test("itendifiers with letters or dashes are compared lexiconumerically", function()
assert_less_than(v'1.0.0-alpha', v'1.0.0-beta')
assert_less_than(v'1.0.0-alpha-10', v'1.0.0-alpha-2')
end)
test("numerical ids always have less priority than lexiconumericals", function()
assert_less_than(v'1.0.0-1', v'1.0.0-alpha')
assert_less_than(v'1.0.0-2', v'1.0.0-1asdf')
end)
test("identifiers can be separated by colons; they must be compared individually", function()
assert_less_than(v'1.0.0-alpha', v'1.0.0-alpha.1')
assert_less_than(v'1.0.0-alpha.1', v'1.0.0-beta.2')
assert_less_than(v'1.0.0-beta.2', v'1.0.0-beta.11')
assert_less_than(v'1.0.0-beta.11', v'1.0.0-rc.1')
end)
end)
end)