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.
koreader/spec/unit/gettext_spec.lua

26 lines
1019 B
Lua

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)