[spec] Version: slight refactor

pull/4316/head
Frans de Jonge 6 years ago
parent be32144829
commit f71627cf1d

@ -13,10 +13,11 @@ describe("Version module", function()
assert.is_true(4 == year:len())
assert.is_true(2 == month:len())
end)
it("should get normalized current version", function()
describe("normalized", function()
it("should get current version", function()
assert.is_true(12 == tostring(Version:getNormalizedCurrentVersion()):len())
end)
it("should get normalized version", function()
it("should get version", function()
local rev = "v2015.11-982-g704d4238"
local version, commit = Version:getNormalizedVersion(rev)
local expected_version = 201511000982
@ -24,7 +25,7 @@ describe("Version module", function()
assert.are.same(expected_version, version)
assert.are.same(expected_commit, commit)
end)
it("should get normalized version with four number revision", function()
it("should get version with four number revision", function()
local rev = "v2015.11-1755-gecd7b5b_2018-07-02"
local version, commit = Version:getNormalizedVersion(rev)
local expected_version = 201511001755
@ -32,7 +33,7 @@ describe("Version module", function()
assert.are.same(expected_version, version)
assert.are.same(expected_commit, commit)
end)
it("should get normalized stable version", function()
it("should get stable version", function()
local rev = "v2018.11"
local version, commit = Version:getNormalizedVersion(rev)
local expected_version = 201811000000
@ -40,7 +41,7 @@ describe("Version module", function()
assert.are.same(expected_version, version)
assert.are.same(expected_commit, commit)
end)
it("should get normalized stable point release version", function()
it("should get stable point release version", function()
local rev = "v2018.11.1"
local version, commit = Version:getNormalizedVersion(rev)
local expected_version = 201811010000
@ -48,7 +49,7 @@ describe("Version module", function()
assert.are.same(expected_version, version)
assert.are.same(expected_commit, commit)
end)
it("should get normalized point release nightly version", function()
it("should get point release nightly version", function()
local rev = "v2018.11.1-1755-gecd7b5b_2018-07-02"
local version, commit = Version:getNormalizedVersion(rev)
local expected_version = 201811011755
@ -56,6 +57,7 @@ describe("Version module", function()
assert.are.same(expected_version, version)
assert.are.same(expected_commit, commit)
end)
end)
it("should fail gracefully", function()
local version, commit = Version:getNormalizedVersion()
local expected_version = nil

Loading…
Cancel
Save