2
0
mirror of https://github.com/koreader/koreader synced 2024-11-13 19:11:25 +00:00
koreader/spec/unit/gettext_spec.lua

26 lines
1019 B
Lua
Raw Normal View History

2017-10-11 12:22:11 +00:00
describe("GetText module", function()
local GetText
setup(function()
require("commonrequire")
GetText = require("gettext")
end)
describe("changeLang", function()
it("should return nil when passing newlang = C", function()
assert.is_nil(GetText.changeLang("C"))
end)
it("should return nil when passing empty string or nil value", function()
assert.is_nil(GetText.changeLang(nil))
assert.is_nil(GetText.changeLang(""))
end)
it("should return nil when passing values that start with en_US", function()
assert.is_nil(GetText.changeLang("en_US"))
assert.is_nil(GetText.changeLang("en_US:en"))
assert.is_nil(GetText.changeLang("en_US.utf8"))
end)
it("should return false when it can't find a po file", function()
assert.is_false(GetText.changeLang("nonsense"))
assert.is_false(GetText.changeLang("more_NONSENSE"))
end)
end)
end)