tests: Fix luacheck warnings
This leaves one warning in tests/test-urgent.lua which points out an actual bug/problem. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
8c26e2dab4
commit
bf3b9b5f42
|
@ -1,7 +1,7 @@
|
||||||
local timer = require("gears.timer")
|
local timer = require("gears.timer")
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
|
||||||
runner = {
|
local runner = {
|
||||||
quit_awesome_on_error = os.getenv('TEST_PAUSE_ON_ERRORS') ~= '1',
|
quit_awesome_on_error = os.getenv('TEST_PAUSE_ON_ERRORS') ~= '1',
|
||||||
-- quit-on-timeout defaults to false: indicates some problem with the test itself.
|
-- quit-on-timeout defaults to false: indicates some problem with the test itself.
|
||||||
quit_awesome_on_timeout = os.getenv('TEST_QUIT_ON_TIMEOUT') ~= '1',
|
quit_awesome_on_timeout = os.getenv('TEST_QUIT_ON_TIMEOUT') ~= '1',
|
||||||
|
|
|
@ -15,7 +15,7 @@ do
|
||||||
local timer_measure = GLib.Timer()
|
local timer_measure = GLib.Timer()
|
||||||
measure = function(f, iter)
|
measure = function(f, iter)
|
||||||
timer_measure:start()
|
timer_measure:start()
|
||||||
for i = 1, iter do
|
for _ = 1, iter do
|
||||||
f()
|
f()
|
||||||
end
|
end
|
||||||
local elapsed = timer_measure:elapsed()
|
local elapsed = timer_measure:elapsed()
|
||||||
|
@ -47,7 +47,7 @@ local function create_and_draw_wibox()
|
||||||
do_pending_repaint()
|
do_pending_repaint()
|
||||||
end
|
end
|
||||||
|
|
||||||
local wb, textclock = create_wibox()
|
local _, textclock = create_wibox()
|
||||||
|
|
||||||
local function relayout_textclock()
|
local function relayout_textclock()
|
||||||
textclock:emit_signal("widget::layout_changed")
|
textclock:emit_signal("widget::layout_changed")
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
--- Tests for focus signals / property.
|
--- Tests for focus signals / property.
|
||||||
-- Test for https://github.com/awesomeWM/awesome/issues/134.
|
-- Test for https://github.com/awesomeWM/awesome/issues/134.
|
||||||
|
|
||||||
awful = require("awful")
|
local awful = require("awful")
|
||||||
timer = require("gears.timer")
|
|
||||||
|
|
||||||
beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
beautiful.border_normal = "#0000ff"
|
beautiful.border_normal = "#0000ff"
|
||||||
beautiful.border_focus = "#00ff00"
|
beautiful.border_focus = "#00ff00"
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,15 @@
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local cairo = require("lgi").cairo
|
local cairo = require("lgi").cairo
|
||||||
local create_wibox = require("_wibox_helper").create_wibox
|
local create_wibox = require("_wibox_helper").create_wibox
|
||||||
local gears = require("gears")
|
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
|
||||||
local errors = {}
|
|
||||||
|
|
||||||
local prepare_for_collect = nil
|
local prepare_for_collect = nil
|
||||||
local function emit_refresh()
|
local function emit_refresh()
|
||||||
awesome.emit_signal("refresh")
|
awesome.emit_signal("refresh")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Make the layoutbox in the default config GC'able
|
-- Make the layoutbox in the default config GC'able
|
||||||
|
-- luacheck: globals mywibox mylayoutbox
|
||||||
mywibox[1].visible = false
|
mywibox[1].visible = false
|
||||||
mywibox = nil
|
mywibox = nil
|
||||||
mylayoutbox = nil
|
mylayoutbox = nil
|
||||||
|
@ -23,7 +21,7 @@ emit_refresh()
|
||||||
local function collectable(a, b, c, d, e, f, g, h, last)
|
local function collectable(a, b, c, d, e, f, g, h, last)
|
||||||
assert(last == nil, "got more arguments than supported")
|
assert(last == nil, "got more arguments than supported")
|
||||||
local objs = setmetatable({ a, b, c, d, e, f, g, h }, { __mode = "v" })
|
local objs = setmetatable({ a, b, c, d, e, f, g, h }, { __mode = "v" })
|
||||||
a, b, c, d, e, f, g, h = nil, nil, nil, nil, nil, nil, nil, nil
|
a, b, c, d, e, f, g, h = nil, nil, nil, nil, nil, nil, nil, nil -- luacheck: ignore
|
||||||
if prepare_for_collect then
|
if prepare_for_collect then
|
||||||
prepare_for_collect()
|
prepare_for_collect()
|
||||||
prepare_for_collect = nil
|
prepare_for_collect = nil
|
||||||
|
@ -31,7 +29,7 @@ local function collectable(a, b, c, d, e, f, g, h, last)
|
||||||
collectgarbage("collect")
|
collectgarbage("collect")
|
||||||
collectgarbage("collect")
|
collectgarbage("collect")
|
||||||
-- Check if the table is now empty
|
-- Check if the table is now empty
|
||||||
for k, v in pairs(objs) do
|
for _, v in pairs(objs) do
|
||||||
print("Some object was not garbage collected!")
|
print("Some object was not garbage collected!")
|
||||||
error(v)
|
error(v)
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,6 @@ local steps = {
|
||||||
if count == 1 then
|
if count == 1 then
|
||||||
ret, snid = spawn('urxvt', true)
|
ret, snid = spawn('urxvt', true)
|
||||||
elseif manage_called then
|
elseif manage_called then
|
||||||
local c = client.get()[1]
|
|
||||||
assert(ret)
|
assert(ret)
|
||||||
assert(snid)
|
assert(snid)
|
||||||
assert(snid == c_snid)
|
assert(snid == c_snid)
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
--- Tests for urgent property.
|
--- Tests for urgent property.
|
||||||
|
|
||||||
awful = require("awful")
|
local awful = require("awful")
|
||||||
|
local runner = require("_runner")
|
||||||
|
|
||||||
|
-- This uses the global "tags" array set in the default config
|
||||||
|
-- luacheck: globals tags
|
||||||
|
|
||||||
-- Some basic assertion that the tag is not marked "urgent" already.
|
-- Some basic assertion that the tag is not marked "urgent" already.
|
||||||
assert(awful.tag.getproperty(tags[1][2], "urgent") == nil)
|
assert(awful.tag.getproperty(tags[1][2], "urgent") == nil)
|
||||||
|
@ -53,7 +57,7 @@ local steps = {
|
||||||
|
|
||||||
elseif awful.tag.selectedlist()[1] == tags[1][2] then
|
elseif awful.tag.selectedlist()[1] == tags[1][2] then
|
||||||
assert(#client.get() == 1)
|
assert(#client.get() == 1)
|
||||||
c = client.get()[1]
|
local c = client.get()[1]
|
||||||
assert(not c.urgent, "Client is not urgent anymore.")
|
assert(not c.urgent, "Client is not urgent anymore.")
|
||||||
assert(c == client.focus, "Client is focused.")
|
assert(c == client.focus, "Client is focused.")
|
||||||
assert(awful.tag.getproperty(tags[1][2], "urgent") == false)
|
assert(awful.tag.getproperty(tags[1][2], "urgent") == false)
|
||||||
|
@ -106,6 +110,6 @@ local steps = {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
require("_runner").run_steps(steps)
|
runner.run_steps(steps)
|
||||||
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||||
|
|
Loading…
Reference in New Issue