Skip to content

Commit

Permalink
test: fix luacheck warnings W311 in test/sql-tap
Browse files Browse the repository at this point in the history
W311 (Value assigned to a local variable is unused)

Part of #5464
  • Loading branch information
ligurio authored and kyukhin committed Mar 2, 2021
1 parent 1952d7b commit 136c682
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .luacheckrc
Expand Up @@ -49,8 +49,6 @@ exclude_files = {

files["test/sql-tap/**/*.lua"] = {
ignore = {
-- "Value assigned to a local variable is unused."
"311",
-- Unreachable code.
"511",
-- Loop can be executed at most once.
Expand Down
16 changes: 8 additions & 8 deletions test/sql-tap/analyze9.test.lua
Expand Up @@ -613,7 +613,7 @@ test:do_execsql_test(
test:do_test(
"10.1.2",
function()
local a = 0
local a
for i = 1, 100 do
if i > 90 then
a = i
Expand Down Expand Up @@ -661,7 +661,7 @@ test:do_execsql_test(
test:do_test(
"10.2.2",
function()
local a = 0
local a
for i = 1, 100 do
if i > 90 then
a = i
Expand Down Expand Up @@ -715,7 +715,7 @@ test:do_execsql_test(
test:do_test(
11.1,
function()
local a = 0
local a
for i = 0, 100 do
if i % 10 == 0 then
a = "\"ABC\""
Expand Down Expand Up @@ -766,7 +766,7 @@ test:do_execsql_test(
test:do_test(
11.5,
function()
local a = 0
local a
for i = 0, 100 do
if i % 10 == 0 then
a = "\"ABC\""
Expand Down Expand Up @@ -827,7 +827,7 @@ test:do_execsql_test(
test:do_test(
12.1,
function()
local a = 0
local a
for i = 0, 100 do
if i % 10 == 0 then
a = "\"ABC\""
Expand Down Expand Up @@ -878,7 +878,7 @@ test:do_execsql_test(
test:do_test(
12.5,
function()
local a = 0
local a
for i = 0, 100 do
if i % 10 == 0 then
a = "\"ABC\""
Expand Down Expand Up @@ -935,7 +935,7 @@ test:do_test(
test:execsql("CREATE TABLE t1(id INTEGER PRIMARY KEY AUTOINCREMENT, a TEXT, b INT, c INT, d INT);")
test:execsql("CREATE INDEX i1 ON t1(a);")
test:execsql("CREATE INDEX i2 ON t1(b, c);")
local a = 0
local a
for i = 0, 100 do
if i % 2 == 1 then
a = "\"abc\""
Expand Down Expand Up @@ -1165,7 +1165,7 @@ test:do_test(
INSERT INTO t1 SELECT null, 2*a,2*b,2*c,d FROM t1;
INSERT INTO t1 SELECT null, 2*a,2*b,2*c,d FROM t1;
]])
local b = 0
local b
for i = 0, 31 do
if (i < 8) then
b = 0
Expand Down
3 changes: 1 addition & 2 deletions test/sql-tap/select9.test.lua
Expand Up @@ -60,10 +60,9 @@ local function subrange(t, first, last)
end

local function test_compound_select(testname, sql, result)
local nCol = 1
local nCol
local A = box.execute(sql) --test.box(sql)
nCol = #A.metadata
A = A.rows
local nRow = #result / nCol
local compound_sql = sql
test:do_execsql_test(
Expand Down
1 change: 0 additions & 1 deletion test/sql-tap/triggerA.test.lua
Expand Up @@ -45,7 +45,6 @@ test:do_test(
INSERT INTO t1 VALUES(%d,'%s');
INSERT INTO t2 VALUES(20-%d,%d,'%s');
]], i, word, i, j, word))
i = i + 1
end
return test:execsql [[
SELECT count(*) FROM t1 UNION ALL SELECT count(*) FROM t2;
Expand Down
2 changes: 1 addition & 1 deletion test/sql-tap/where2.test.lua
Expand Up @@ -103,7 +103,7 @@ local function queryplan(sql)
table.insert(data, tab)
table.insert(data, idx)
else
as, tab = string.match(v, "TABLE (%w+ AS) (%w+)")
local _, tab = string.match(v, "TABLE (%w+ AS) (%w+)")
if tab == nil then
tab = string.match(v, "TABLE (%w+)")
end
Expand Down

0 comments on commit 136c682

Please sign in to comment.