Fix all luacheck warnings in spec/

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-02-07 13:10:21 +01:00
parent 2c24449a96
commit cf1576cdd8
6 changed files with 21 additions and 23 deletions

View File

@ -4,7 +4,6 @@
---------------------------------------------------------------------------
local util = require("awful.util")
local say = require("say")
describe("awful.util", function()
it("table.keys_filter", function()

View File

@ -162,7 +162,7 @@ describe("gears.color", function()
describe("create_opaque_pattern", function()
-- Assertion to check if a pattern is opaque
local function opaque(state, arguments)
local function opaque(_, arguments)
assert(arguments.n >= 1, say("assertions.argtolittle", { "opaque", 1, tostring(arguments.n) }))
local pattern = color.create_opaque_pattern(arguments[1])
return pattern ~= nil

View File

@ -54,7 +54,7 @@ describe("gears.object", function()
obj:weak_connect_signal("signal", cb)
-- Check that the GC doesn't disconnect the signal
for i = 1, 10 do
for _ = 1, 10 do
collectgarbage("collect")
end
@ -149,7 +149,8 @@ describe("gears.object", function()
finalized = true
end
if _VERSION <= "Lua 5.1" then
local userdata = newproxy(true)
-- luacheck: globals newproxy
userdata = newproxy(true)
getmetatable(userdata).__gc = gc
getmetatable(userdata).callback = callback
else

View File

@ -6,24 +6,24 @@
-- Hack so that beautiful can be loaded
_G.awesome = {
xrdb_get_value = function() end,
connect_signal = function(...) end,
register_xproperty = function(...) end
connect_signal = function() end,
register_xproperty = function() end
}
-- Additional hacks to load menubar
_G.screen = {
add_signal = function(...) end,
add_signal = function() end,
count = function() return 0 end
}
_G.client = {
connect_signal = function(...) end,
add_signal = function(...) end
connect_signal = function() end,
add_signal = function() end
}
_G.tag = {
connect_signal = function(...) end,
add_signal = function(...) end
connect_signal = function() end,
add_signal = function() end
}
_G.root = {
cursor = function(...) end
cursor = function() end
}
local os = os

View File

@ -7,7 +7,6 @@ local hierarchy = require("wibox.hierarchy")
local Region = require("lgi").cairo.Region
local matrix = require("gears.matrix")
local object = require("gears.object")
local utils = require("wibox.test_utils")
local function make_widget(children)
@ -18,8 +17,8 @@ local function make_widget(children)
return result
end
local function make_child(widget, width, height, matrix)
return { _widget = widget, _width = width, _height = height, _matrix = matrix }
local function make_child(widget, width, height, mat)
return { _widget = widget, _width = width, _height = height, _matrix = mat }
end
describe("wibox.hierarchy", function()
@ -95,7 +94,7 @@ describe("wibox.hierarchy", function()
end
end
local context = {}
local instance = hierarchy.new(context, parent, 15, 20, redraw, layout, extra_arg)
local instance = hierarchy.new(context, parent, 15, 20, redraw, layout, extra_arg) -- luacheck: no unused
-- There should be a connection
parent:emit_signal("widget::redraw_needed")
@ -140,7 +139,7 @@ describe("wibox.hierarchy", function()
assert.is.equal(#children, 1)
hierarchy_intermediate = children[1]
local children = hierarchy_intermediate:get_children()
children = hierarchy_intermediate:get_children()
assert.is.equal(#children, 1)
hierarchy_child = children[1]
end)

View File

@ -4,7 +4,6 @@
---------------------------------------------------------------------------
local object = require("gears.object")
local cache = require("gears.cache")
local matrix_equals = require("gears.matrix").equals
local base = require("wibox.widget.base")
local say = require("say")
@ -53,11 +52,11 @@ local function widget_layout(state, arguments)
fits = false
else
for i = 1, #children do
local child, expected = children[i], expected[i]
if child._widget ~= expected._widget or
child._width ~= expected._width or
child._height ~= expected._height or
not matrix_equals(child._matrix, expected._matrix) then
local child, exp = children[i], expected[i]
if child._widget ~= exp._widget or
child._width ~= exp._width or
child._height ~= exp._height or
not matrix_equals(child._matrix, exp._matrix) then
fits = false
break
end