From cf1576cdd8ecc55d40fb98e7bb6dccc796830f95 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 7 Feb 2016 13:10:21 +0100 Subject: [PATCH] Fix all luacheck warnings in spec/ Signed-off-by: Uli Schlachter --- spec/awful/util_spec.lua | 1 - spec/gears/color_spec.lua | 2 +- spec/gears/object_spec.lua | 5 +++-- spec/menubar/icon_theme_spec.lua | 16 ++++++++-------- spec/wibox/hierarchy_spec.lua | 9 ++++----- spec/wibox/test_utils.lua | 11 +++++------ 6 files changed, 21 insertions(+), 23 deletions(-) diff --git a/spec/awful/util_spec.lua b/spec/awful/util_spec.lua index 5e39f1819..07bb1da10 100644 --- a/spec/awful/util_spec.lua +++ b/spec/awful/util_spec.lua @@ -4,7 +4,6 @@ --------------------------------------------------------------------------- local util = require("awful.util") -local say = require("say") describe("awful.util", function() it("table.keys_filter", function() diff --git a/spec/gears/color_spec.lua b/spec/gears/color_spec.lua index e7694e349..47b157ca5 100644 --- a/spec/gears/color_spec.lua +++ b/spec/gears/color_spec.lua @@ -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 diff --git a/spec/gears/object_spec.lua b/spec/gears/object_spec.lua index e63463dcf..2f41f0d1f 100644 --- a/spec/gears/object_spec.lua +++ b/spec/gears/object_spec.lua @@ -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 diff --git a/spec/menubar/icon_theme_spec.lua b/spec/menubar/icon_theme_spec.lua index f02fd3a82..8588d3a27 100644 --- a/spec/menubar/icon_theme_spec.lua +++ b/spec/menubar/icon_theme_spec.lua @@ -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 diff --git a/spec/wibox/hierarchy_spec.lua b/spec/wibox/hierarchy_spec.lua index 55d7dc94e..92541bc01 100644 --- a/spec/wibox/hierarchy_spec.lua +++ b/spec/wibox/hierarchy_spec.lua @@ -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) diff --git a/spec/wibox/test_utils.lua b/spec/wibox/test_utils.lua index 08d2b01bc..a557df76c 100644 --- a/spec/wibox/test_utils.lua +++ b/spec/wibox/test_utils.lua @@ -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