2016-02-04 14:03:50 +01:00
|
|
|
--- Test for awful.widget.watch
|
|
|
|
|
2016-03-06 10:20:45 +01:00
|
|
|
local runner = require("_runner")
|
2016-02-04 14:03:50 +01:00
|
|
|
local watch = require("awful.widget.watch")
|
|
|
|
|
|
|
|
local callbacks_done = 0
|
|
|
|
|
|
|
|
local steps = {
|
|
|
|
function(count)
|
|
|
|
if count == 1 then
|
|
|
|
watch(
|
|
|
|
"echo hi", 0.1,
|
|
|
|
function(widget, stdout, stderr, exitreason, exitcode)
|
|
|
|
assert(widget == "i_am_widget_mock", widget)
|
|
|
|
assert(stdout == "hi\n", stdout)
|
|
|
|
assert(stderr == "", stderr)
|
|
|
|
assert(exitreason == "exit", exitreason)
|
|
|
|
assert(exitcode == 0, exitcode)
|
|
|
|
callbacks_done = callbacks_done + 1
|
|
|
|
end,
|
|
|
|
"i_am_widget_mock"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
if callbacks_done > 1 then -- timer fired at least twice
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
2016-03-06 10:20:45 +01:00
|
|
|
runner.run_steps(steps)
|
2016-02-04 14:03:50 +01:00
|
|
|
|
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|