Skip to content

Instantly share code, notes, and snippets.

@psychon
Created September 3, 2015 08:57
Show Gist options
  • Save psychon/16920283f0b8253eddfd to your computer and use it in GitHub Desktop.
Save psychon/16920283f0b8253eddfd to your computer and use it in GitHub Desktop.
---------------------------------------------------------------------------
-- @author Uli Schlachter
-- @copyright 2015 Uli Schlachter
---------------------------------------------------------------------------
-- Hack so that beautiful can be loaded
_G.awesome = {
xrdb_get_value = function() end
}
local kb = require("awful.widget.keyboardlayout")
describe("awful.widget.keyboardlayout get_groups_from_group_names", function()
it("nil", function()
assert.is_nil(kb.get_groups_from_group_names(nil))
end)
local tests = {
["pc+us+ru:2+de:3+ba:4+inet"] = {
{ file = "us", group_idx = 1 },
{ file = "ru", group_idx = 2 },
{ file = "de", group_idx = 3 },
{ file = "ba", group_idx = 4 },
},
["macintosh_vndr/apple(alukbd)+macintosh_vndr/jp(usmac)+macintosh_vndr/jp(mac):2"] = {
{ file = "jp", group_idx = 1, vendor = "macintosh_vndr", section = "usmac" },
{ file = "jp", group_idx = 2, vendor = "macintosh_vndr", section = "mac" },
},
}
for arg, expected in pairs(tests) do
it(arg, function()
assert.is.same(expected, kb.get_groups_from_group_names(arg))
end)
end
end)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment