mirror of https://github.com/koreader/koreader
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.1 KiB
Lua
29 lines
1.1 KiB
Lua
7 years ago
|
describe("Version module", function()
|
||
|
local Version
|
||
|
setup(function()
|
||
|
require("commonrequire")
|
||
|
Version = require("version")
|
||
|
end)
|
||
|
it("should get current revision", function()
|
||
|
assert.is_true(22 >= (Version:getCurrentRevision()):len())
|
||
|
end)
|
||
|
it("should get normalized current version", function()
|
||
|
assert.is_true(9 >= tostring(Version:getNormalizedCurrentVersion()):len())
|
||
|
end)
|
||
|
it("should get normalized version", function()
|
||
|
local rev = "v2015.11-982-g704d4238"
|
||
|
local version, commit = Version:getNormalizedVersion(rev)
|
||
|
local expected_version = 201511982
|
||
|
local expected_commit = "704d4238"
|
||
|
assert.are.same(expected_version, version)
|
||
|
assert.are.same(expected_commit, commit)
|
||
|
end)
|
||
|
it("should fail gracefully", function()
|
||
|
local version, commit = Version:getNormalizedVersion()
|
||
|
local expected_version = nil
|
||
|
local expected_commit = nil
|
||
|
assert.are.same(expected_version, version)
|
||
|
assert.are.same(expected_commit, commit)
|
||
|
end)
|
||
|
end)
|