diff --git a/tests/examples/awful/template.lua b/tests/examples/awful/template.lua index 42c0a897f..21dfdedc6 100644 --- a/tests/examples/awful/template.lua +++ b/tests/examples/awful/template.lua @@ -5,13 +5,14 @@ local pango = require("lgi").Pango local pangocairo = require("lgi").PangoCairo -- Set the global shims --- luacheck: globals awesome root tag screen client mouse +-- luacheck: globals awesome root tag screen client mouse drawin awesome = require( "awesome" ) root = require( "root" ) tag = require( "tag" ) screen = require( "screen" ) client = require( "client" ) mouse = require( "mouse" ) +drawin = require( "drawin" ) -- Force luacheck to be silent about setting those as unused globals assert(awesome and root and tag and screen and client and mouse) diff --git a/tests/examples/shims/drawin.lua b/tests/examples/shims/drawin.lua new file mode 100644 index 000000000..d8c289129 --- /dev/null +++ b/tests/examples/shims/drawin.lua @@ -0,0 +1,23 @@ +local gears_obj = require("gears.object") + +local drawin, meta = awesome._shim_fake_class() + +local function new_drawin(_, args) + local ret = gears_obj() + + for k, v in pairs(args) do + rawset(ret, k, v) + end + + return setmetatable(ret, { + __index = function(...) return meta.__index(...) end, + __newindex = function(...) return meta.__newindex(...) end + }) +end + +return setmetatable(drawin, { + __call = new_drawin, +}) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 + diff --git a/tests/examples/wibox/template.lua b/tests/examples/wibox/template.lua index 3e8d0e0ca..c035185ae 100644 --- a/tests/examples/wibox/template.lua +++ b/tests/examples/wibox/template.lua @@ -1,10 +1,11 @@ local file_path, image_path, luacovpath = ... -- Set the global shims --- luacheck: globals awesome client tag +-- luacheck: globals awesome client tag drawin awesome = require( "awesome" ) client = require( "client" ) tag = require( "tag" ) +drawin = require( "drawin" ) -- Force luacheck to be silent about setting those as unused globals assert(awesome and client and tag)