mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Version spec: slight improvements
This commit is contained in:
committed by
Qingping Hou
parent
8df1e14b6f
commit
a192178bf6
@@ -5,10 +5,20 @@ describe("Version module", function()
|
||||
Version = require("version")
|
||||
end)
|
||||
it("should get current revision", function()
|
||||
assert.is_true(22 >= (Version:getCurrentRevision()):len())
|
||||
local rev = Version:getCurrentRevision()
|
||||
local year, month, revision = rev:match("v(%d%d%d%d)%.(%d%d)-?(%d*)")
|
||||
local commit = rev:match("-%d*-g(.*)")
|
||||
assert.is_truthy(year)
|
||||
assert.is_truthy(month)
|
||||
assert.is_truthy(revision)
|
||||
assert.is_truthy(commit)
|
||||
assert.is_true(4 <= year:len())
|
||||
assert.is_true(2 == month:len())
|
||||
assert.is_true(1 <= revision:len())
|
||||
assert.is_true(5 <= commit:len())
|
||||
end)
|
||||
it("should get normalized current version", function()
|
||||
assert.is_true(9 >= tostring(Version:getNormalizedCurrentVersion()):len())
|
||||
assert.is_true(7 <= tostring(Version:getNormalizedCurrentVersion()):len())
|
||||
end)
|
||||
it("should get normalized version", function()
|
||||
local rev = "v2015.11-982-g704d4238"
|
||||
|
||||
Reference in New Issue
Block a user