2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

[chore, spec] Version: test 8-character hash just in case (#7809)

Cf. https://github.com/koreader/koreader/issues/7805#issuecomment-855337115.
This commit is contained in:
Frans de Jonge 2021-06-06 18:15:52 +02:00 committed by GitHub
parent d8ea93662f
commit 27fa19c9c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ describe("Version module", function()
it("should get current version", function() it("should get current version", function()
assert.is_true(12 == tostring(Version:getNormalizedCurrentVersion()):len()) assert.is_true(12 == tostring(Version:getNormalizedCurrentVersion()):len())
end) end)
it("should get version", function() it("should get version with 7-character hash", function()
local rev = "v2015.11-982-g704d4238" local rev = "v2015.11-982-g704d4238"
local version, commit = Version:getNormalizedVersion(rev) local version, commit = Version:getNormalizedVersion(rev)
local expected_version = 201511000982 local expected_version = 201511000982
@ -25,6 +25,14 @@ describe("Version module", function()
assert.are.same(expected_version, version) assert.are.same(expected_version, version)
assert.are.same(expected_commit, commit) assert.are.same(expected_commit, commit)
end) end)
it("should get version with 8-character hash", function()
local rev = "v2021.05-70-gae544b74"
local version, commit = Version:getNormalizedVersion(rev)
local expected_version = 202105000070
local expected_commit = "ae544b74"
assert.are.same(expected_version, version)
assert.are.same(expected_commit, commit)
end)
it("should get 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 rev = "v2015.11-1755-gecd7b5b_2018-07-02"
local version, commit = Version:getNormalizedVersion(rev) local version, commit = Version:getNormalizedVersion(rev)