[Tarantool-patches] [PATCH 12/19] Fix luacheck warnings in test/sql-tap
sergeyb at tarantool.org
sergeyb at tarantool.org
Thu Jul 16 17:11:42 MSK 2020
From: Sergey Bronnikov <sergeyb at tarantool.org>
Part of #4681
Reviewed-by: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
Reviewed-by: Igor Munkin <imun at tarantool.org>
Co-authored-by: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
Co-authored-by: Igor Munkin <imun at tarantool.org>
---
.luacheckrc | 1 -
test/sql-tap/alter.test.lua | 4 ++--
test/sql-tap/analyze5.test.lua | 2 +-
test/sql-tap/analyze9.test.lua | 22 +++++++++----------
test/sql-tap/between.test.lua | 4 ++--
test/sql-tap/date.test.lua | 3 ++-
test/sql-tap/delete1.test.lua | 2 +-
test/sql-tap/e_delete.test.lua | 2 +-
test/sql-tap/e_expr.test.lua | 11 +++++-----
test/sql-tap/func.test.lua | 2 +-
test/sql-tap/func3.test.lua | 2 +-
test/sql-tap/gh-2723-concurrency.test.lua | 8 +++----
.../gh-3083-ephemeral-unref-tuples.test.lua | 2 +-
.../gh-3307-xfer-optimization-issue.test.lua | 2 +-
.../gh-3332-tuple-format-leak.test.lua | 2 +-
.../gh2127-indentifier-max-length.test.lua | 10 ++++-----
test/sql-tap/identifier-characters.test.lua | 2 +-
test/sql-tap/index1.test.lua | 3 +--
test/sql-tap/index7.test.lua | 2 +-
test/sql-tap/join3.test.lua | 2 +-
test/sql-tap/lua-tables.test.lua | 2 +-
test/sql-tap/lua/sqltester.lua | 11 +++++-----
test/sql-tap/misc1.test.lua | 10 ++++-----
test/sql-tap/misc5.test.lua | 2 +-
test/sql-tap/select1.test.lua | 10 ++++-----
test/sql-tap/select2.test.lua | 8 +++----
test/sql-tap/select4.test.lua | 1 -
test/sql-tap/select5.test.lua | 1 -
test/sql-tap/select9.test.lua | 12 ++++------
test/sql-tap/selectA.test.lua | 8 +------
test/sql-tap/selectB.test.lua | 14 ++++++------
test/sql-tap/selectG.test.lua | 1 -
test/sql-tap/sort.test.lua | 2 +-
test/sql-tap/sql-errors.test.lua | 2 +-
test/sql-tap/table.test.lua | 3 ++-
test/sql-tap/tkt-38cb5df375.test.lua | 1 -
test/sql-tap/tkt-91e2e8ba6f.test.lua | 3 ---
test/sql-tap/tkt-9a8b09f8e6.test.lua | 3 ---
test/sql-tap/tkt-bd484a090c.test.lua | 3 ++-
test/sql-tap/tkt2192.test.lua | 3 ++-
test/sql-tap/tkt3493.test.lua | 3 ---
test/sql-tap/trigger2.test.lua | 4 ++--
test/sql-tap/triggerA.test.lua | 1 -
test/sql-tap/where2.test.lua | 9 +++-----
test/sql-tap/where3.test.lua | 2 +-
test/sql-tap/where4.test.lua | 4 ++--
test/sql-tap/where5.test.lua | 2 +-
test/sql-tap/where6.test.lua | 2 +-
test/sql-tap/where7.test.lua | 16 +++++++-------
test/sql-tap/whereA.test.lua | 2 +-
test/sql-tap/whereB.test.lua | 2 +-
test/sql-tap/whereC.test.lua | 5 ++---
test/sql-tap/whereD.test.lua | 4 ++--
test/sql-tap/whereF.test.lua | 4 ++--
test/sql-tap/whereG.test.lua | 4 ++--
test/sql-tap/whereI.test.lua | 4 ++--
test/sql-tap/whereK.test.lua | 4 ++--
test/sql-tap/with1.test.lua | 14 ++++++------
test/sql-tap/with2.test.lua | 18 +++++++--------
59 files changed, 133 insertions(+), 159 deletions(-)
diff --git a/.luacheckrc b/.luacheckrc
index 646c844d6..237b9e456 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -44,7 +44,6 @@ exclude_files = {
"test/engine/*.test.lua",
"test/engine_long/*.test.lua",
"test/replication/*.test.lua",
- "test/sql-tap/**/*.lua",
"test/sql/*.test.lua",
"test/swim/**/*.lua",
"test/var/**/*.lua",
diff --git a/test/sql-tap/alter.test.lua b/test/sql-tap/alter.test.lua
index 615b9d8a6..4983b711c 100755
--- a/test/sql-tap/alter.test.lua
+++ b/test/sql-tap/alter.test.lua
@@ -90,7 +90,7 @@ test:do_catchsql_test(
test:do_test(
"alter-2.3.prepare",
function()
- format = {}
+ local format = {}
format[1] = { name = 'id', type = 'integer'}
format[2] = { name = 'f2', type = 'number'}
s = box.schema.create_space('t', {format = format})
@@ -520,7 +520,7 @@ test:do_catchsql_test(
test:do_test(
"alter-8.1.0",
function()
- format = {}
+ local format = {}
format[1] = { name = 'id', type = 'scalar'}
format[2] = { name = 'f2', type = 'scalar'}
s = box.schema.create_space('T', {format = format})
diff --git a/test/sql-tap/analyze5.test.lua b/test/sql-tap/analyze5.test.lua
index 45e76492a..0ea0ac07e 100755
--- a/test/sql-tap/analyze5.test.lua
+++ b/test/sql-tap/analyze5.test.lua
@@ -26,7 +26,7 @@ local function eqp(sql)
return test:execsql("EXPLAIN QUERY PLAN"..sql)
end
-local function alpha(blob)
+local function alpha()
ret = ""
for _, c in ipairs(X(37, "X!cmd", [=[["split",["blob"],""]]=])) do
if X(39, "X!cmd", [=[["string","is","alpha",["c"]]]=])
diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 02eb49f69..0fcca14fc 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -160,7 +160,7 @@ end
box.internal.sql_create_function("lrange", "TEXT", lrange)
generate_tens = function(n)
- tens = {}
+ local tens = {}
for i = 1, n do
tens[i] = 10
end
@@ -168,7 +168,7 @@ generate_tens = function(n)
end
generate_tens_str = function(n)
- tens = {}
+ local tens = {}
for i = 1, n do
tens[i] = "10"
end
@@ -239,7 +239,7 @@ test:do_execsql_test(
insert_filler_rows_n = function(iStart, nCopy, nVal)
for i = 0, nVal-1 do
local iVal = iStart+i
- for j = 0, nCopy-1 do
+ for _ = 0, nCopy-1 do
box.execute(string.format("INSERT INTO t1 VALUES (null, %s, %s, '%s')", iVal, iVal, iVal))
end
end
@@ -609,7 +609,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
@@ -657,7 +657,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
@@ -711,7 +711,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\""
@@ -762,7 +762,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\""
@@ -823,7 +823,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\""
@@ -874,7 +874,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\""
@@ -931,7 +931,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\""
@@ -1161,7 +1161,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
diff --git a/test/sql-tap/between.test.lua b/test/sql-tap/between.test.lua
index 60d9ae1d6..436106f83 100755
--- a/test/sql-tap/between.test.lua
+++ b/test/sql-tap/between.test.lua
@@ -60,11 +60,11 @@ local function queryplan(sql)
table.insert(data,x)
local eqp = box.execute("EXPLAIN QUERY PLAN "..sql.."").rows
-- puts eqp=$eqp
- for i, val in ipairs(eqp) do
+ for _, val in ipairs(eqp) do
--local a = val[1]
--local b = val[2]
--local c = val[3]
- local x = val[4]
+ x = val[4]
local tab, idx = string.match(x, "TABLE (%w+) USING.* INDEX (%w+)")
if tab then
diff --git a/test/sql-tap/date.test.lua b/test/sql-tap/date.test.lua
index 87fc80db0..b2d59000e 100755
--- a/test/sql-tap/date.test.lua
+++ b/test/sql-tap/date.test.lua
@@ -29,7 +29,8 @@ test:plan(0)
-- Disabled until #3694 is resolved.
--
-if false then
+local enable_broken_tests = false
+if enable_broken_tests then
local function datetest(tnum, expr, result)
test:do_test(
"date-"..tnum,
diff --git a/test/sql-tap/delete1.test.lua b/test/sql-tap/delete1.test.lua
index bfed3ba9d..7d7146715 100755
--- a/test/sql-tap/delete1.test.lua
+++ b/test/sql-tap/delete1.test.lua
@@ -132,7 +132,7 @@ test:do_test(
})
-- Tests for data dictionary integration.
-format = {}
+local format = {}
format[1] = {name = 'id', type = 'scalar'}
format[2] = {name = 'f', type = 'scalar'}
s = box.schema.create_space('t', {format = format})
diff --git a/test/sql-tap/e_delete.test.lua b/test/sql-tap/e_delete.test.lua
index a0c944327..d1cf2a79f 100755
--- a/test/sql-tap/e_delete.test.lua
+++ b/test/sql-tap/e_delete.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(18)
--!./tcltestrunner.lua
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index 7ee7a2d98..9aeae0d13 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -1077,7 +1077,7 @@ test:do_execsql_test(
--
-- MUST_WORK_TEST prepared statements
if (0>0) then
- local function parameter_test(tn, sql, params, result)
+ local function parameter_test(tn, sql, params, result) -- luacheck: no unused args
stmt = sql_prepare_v2("db", sql, -1)
for _ in X(0, "X!foreach", [=[["number name",["params"]]]=]) do
nm = sql_bind_parameter_name(stmt, number)
@@ -1264,7 +1264,7 @@ test:do_execsql_test(
test:execsql [[
CREATE TABLE tblname(cname INT PRIMARY KEY);
]]
-local function glob(args)
+local function glob()
return 1
end
@@ -2121,7 +2121,7 @@ test:do_execsql_test(
local likeargs = {}
function likefunc(...)
local args = {...}
- for i, v in ipairs(args) do
+ for _, v in ipairs(args) do
table.insert(likeargs, v)
end
return 1
@@ -2356,7 +2356,7 @@ end
local regexpargs = {}
local function regexpfunc(...)
local args = {...}
- for i, v in ipairs(args) do
+ for _, v in ipairs(args) do
table.insert(regexpargs, v)
end
return 1
@@ -2415,7 +2415,7 @@ test:do_test(
local matchargs = { }
local function matchfunc(...)
local args = {...}
- for i, v in ipairs(args) do
+ for _, v in ipairs(args) do
table.insert(matchargs, v)
end
return 1
@@ -2678,6 +2678,7 @@ if 0>0 then
-- comparisons take place.
--
+ -- luacheck: ignore (loop is executed at most once)
for _ in X(0, "X!foreach", [=[["a b c",[["list",[["expr","3"]],[["expr","4"]],[["expr","5"]]]]]]=]) do
break
end
diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
index 3c088920f..eac930857 100755
--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -1472,7 +1472,7 @@ test:do_test(
test:do_test(
"func-17.1",
function()
- local function testfunc1(args)
+ local function testfunc1()
X(768, "X!cmd", [=[["error","Error %d with %s percents %p"]]=])
end
diff --git a/test/sql-tap/func3.test.lua b/test/sql-tap/func3.test.lua
index 95d96965e..e9cc45e93 100755
--- a/test/sql-tap/func3.test.lua
+++ b/test/sql-tap/func3.test.lua
@@ -288,7 +288,7 @@ test:do_test(
--
-- gh-3929: sql: ANSI aliases for LENGTH().
--
-suits = {}
+local suits = {}
suits[1] = {str = '123456789', len = 9}
suits[2] = {str = '\x80', len = 1}
suits[3] = {str = '\x61\x62\x63', len = 3}
diff --git a/test/sql-tap/gh-2723-concurrency.test.lua b/test/sql-tap/gh-2723-concurrency.test.lua
index 842142d2d..4b8788ce2 100755
--- a/test/sql-tap/gh-2723-concurrency.test.lua
+++ b/test/sql-tap/gh-2723-concurrency.test.lua
@@ -20,7 +20,7 @@ for id = 1, N do
end
)
end
-for id = 1, N do
+for _ = 1, N do
ch:get()
end
@@ -46,7 +46,7 @@ for id = 1, N do
end
)
end
-for id = 1, N do
+for _ = 1, N do
ch:get()
end
test:do_test(
@@ -64,7 +64,7 @@ box.execute("create index i1 on t1(b);")
for id = 1, N*N do
box.execute(string.format("insert into t1 values(%s, %s, 3)", id, id))
end
-for id = 1, N do
+for _ = 1, N do
fiber.create(
function ()
box.execute("delete from t1")
@@ -72,7 +72,7 @@ for id = 1, N do
end
)
end
-for id = 1, N do
+for _ = 1, N do
ch:get()
end
test:do_test(
diff --git a/test/sql-tap/gh-3083-ephemeral-unref-tuples.test.lua b/test/sql-tap/gh-3083-ephemeral-unref-tuples.test.lua
index 3807ba665..0e73a940f 100755
--- a/test/sql-tap/gh-3083-ephemeral-unref-tuples.test.lua
+++ b/test/sql-tap/gh-3083-ephemeral-unref-tuples.test.lua
@@ -12,7 +12,7 @@ test:do_test(
box.execute("insert into test(id, k) values(" .. i .. "," .. i .. ")")
end
- for i = 1, 10000 do
+ for _ = 1, 10000 do
box.execute("SELECT id, k FROM test WHERE k IN (5849, 4986, 4997, 5020, 5044, 4990, 5013, 4983)")
end
end, {
diff --git a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
index bb8a4989e..5b9df5c09 100755
--- a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
+++ b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(39)
local function do_xfer_test(test, test_func, test_name, func, exp, opts)
diff --git a/test/sql-tap/gh-3332-tuple-format-leak.test.lua b/test/sql-tap/gh-3332-tuple-format-leak.test.lua
index 84e67b7ef..05c440e47 100755
--- a/test/sql-tap/gh-3332-tuple-format-leak.test.lua
+++ b/test/sql-tap/gh-3332-tuple-format-leak.test.lua
@@ -21,7 +21,7 @@ test:do_test(
test:do_test(
"format-leak",
function()
- for i = 1, 100000 do
+ for _ = 1, 100000 do
box.execute("SELECT id FROM t1 WHERE flags=3 ORDER BY id LIMIT 2");
end
end, {
diff --git a/test/sql-tap/gh2127-indentifier-max-length.test.lua b/test/sql-tap/gh2127-indentifier-max-length.test.lua
index 46efffeed..e37281913 100755
--- a/test/sql-tap/gh2127-indentifier-max-length.test.lua
+++ b/test/sql-tap/gh2127-indentifier-max-length.test.lua
@@ -7,7 +7,7 @@ local tt = {}
local table_word = "АААААААААА"
-- Create 30kb table name
-for i=1,300 do
+for _=1,300 do
table.insert(tt, table_word)
end
@@ -27,7 +27,7 @@ local vt = {}
local view_word = "BBBBBBBBBB"
-- Create 30kb view name
-for i=1, 300 do
+for _=1, 300 do
table.insert(vt, view_word)
end
@@ -45,7 +45,7 @@ local it = {}
local index_word = "ЕЕЕЕЕЕЕЕЕЕ"
-- Create 30kb index name
-for i=1, 300 do
+for _=1, 300 do
table.insert(it, index_word)
end
@@ -55,7 +55,7 @@ local field_table = {}
local field_word = 'ДДДДДДДДД'
-- Create 30kb field name
-for i=1, 300 do
+for _=1, 300 do
table.insert(field_table, field_word)
end
@@ -75,7 +75,7 @@ test:do_execsql_test(
local trig_table = {}
local trigger_word = "ССССССССС"
-for i=1, 300 do
+for _=1, 300 do
table.insert(trig_table, trigger_word)
end
diff --git a/test/sql-tap/identifier-characters.test.lua b/test/sql-tap/identifier-characters.test.lua
index 27ed2f889..65a738f5d 100755
--- a/test/sql-tap/identifier-characters.test.lua
+++ b/test/sql-tap/identifier-characters.test.lua
@@ -65,7 +65,7 @@ local testcases = {
test:execsql("commit")
if ok == false then error(res) end
end,
- function (id) end},
+ function () end},
{"trigger name",
function (id)
test:execsql(string.format([[
diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
index e173e685c..f1394199e 100755
--- a/test/sql-tap/index1.test.lua
+++ b/test/sql-tap/index1.test.lua
@@ -106,7 +106,6 @@ test:do_test(
test:do_test(
"index-2.2",
function()
- local msg
local v , msg= pcall(function()
test:execsql("CREATE INDEX index1 ON test1(f1, f2, f4, f3)")
end)
@@ -1019,7 +1018,7 @@ end
test:do_test(
"index-22.1.0",
function()
- format = {}
+ local format = {}
format[1] = { name = 'id', type = 'scalar'}
format[2] = { name = 'f2', type = 'scalar'}
s = box.schema.create_space('T', {format = format})
diff --git a/test/sql-tap/index7.test.lua b/test/sql-tap/index7.test.lua
index c98f17218..4506fd97e 100755
--- a/test/sql-tap/index7.test.lua
+++ b/test/sql-tap/index7.test.lua
@@ -22,7 +22,7 @@ test:plan(12)
-- Capture the output of a pragma in a TEMP table.
--
-local function capture_pragma(db, tabname, sql)
+local function capture_pragma()
once = 1
end
diff --git a/test/sql-tap/join3.test.lua b/test/sql-tap/join3.test.lua
index 876b3121a..030fbaba3 100755
--- a/test/sql-tap/join3.test.lua
+++ b/test/sql-tap/join3.test.lua
@@ -49,7 +49,7 @@ for N=1, bitmask_size do
end
-- Joins with a comparison
--
-local result = {}
+result = {}
--for _ in X(0, "X!for", [=[["set N 1","$N<=$bitmask_size","incr N"]]=]) do
for N=1, bitmask_size do
table.insert(result,N)
diff --git a/test/sql-tap/lua-tables.test.lua b/test/sql-tap/lua-tables.test.lua
index 07e0f6a1e..16c89a8e8 100755
--- a/test/sql-tap/lua-tables.test.lua
+++ b/test/sql-tap/lua-tables.test.lua
@@ -5,7 +5,7 @@ test:plan(14)
test:do_test(
"lua-tables-prepare-1",
function()
- format = {}
+ local format = {}
format[1] = { name = 'id', type = 'scalar'}
format[2] = { name = 'f2', type = 'scalar'}
s = box.schema.create_space('t', {format = format})
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 9b0218e63..79702f1fb 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -176,8 +176,8 @@ local function execsql(self, sql)
end
test.execsql = execsql
-local function catchsql(self, sql, expect)
- r = {pcall(execsql, self, sql) }
+local function catchsql(self, sql)
+ local r = {pcall(execsql, self, sql) }
if r[1] == true then
r[1] = 0
else
@@ -256,7 +256,7 @@ end
test.sortsql = sortsql
local function catchsql2(self, sql)
- r = {pcall(execsql2, self, sql) }
+ local r = {pcall(execsql2, self, sql) }
-- 0 means ok
-- 1 means not ok
r[1] = r[1] == true and 0 or 1
@@ -271,8 +271,8 @@ test.catchsql2 = catchsql2
-- opcode at the beginning. This procedure can be used to prove
-- that different SQL statements generate exactly the same VDBE code.
local function explain_no_trace(self, sql)
- tr = execsql(self, "EXPLAIN "..sql)
- for i=1,8 do
+ local tr = execsql(self, "EXPLAIN "..sql)
+ for _=1,8 do
table.remove(tr,1)
end
return tr
@@ -378,7 +378,6 @@ function test.randstr(Length)
for Loop = 0, 255 do
Chars[Loop+1] = string.char(Loop)
end
- local String = table.concat(Chars)
local Result = {}
local Lookup = Chars
local Range = #Lookup
diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
index 32f38cc97..40b53b3d6 100755
--- a/test/sql-tap/misc1.test.lua
+++ b/test/sql-tap/misc1.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(59)
--!./tcltestrunner.lua
@@ -583,7 +583,7 @@ if (0 > 0) then
test:execsql("START TRANSACTION")
test:execsql("UPDATE t1 SET a=0 WHERE 0")
sql("db2", "test.db")
- rc = X(371, "X!cmd", [=[["catch","db2 eval {SELECT count(*) FROM t1}","msg"]]=])
+ local rc = X(371, "X!cmd", [=[["catch","db2 eval {SELECT count(*) FROM t1}","msg"]]=])
return table.insert(rc,msg) or rc
-- v2 result: {1 {database is locked}}
end, {
@@ -596,7 +596,7 @@ if (0 > 0) then
"misc1-11.2",
function()
test:execsql("COMMIT")
- rc = X(377, "X!cmd", [=[["catch","db2 eval {SELECT count(*) FROM t1}","msg"]]=])
+ local rc = X(377, "X!cmd", [=[["catch","db2 eval {SELECT count(*) FROM t1}","msg"]]=])
db2("close")
return table.insert(rc,msg) or rc
end, {
@@ -726,7 +726,7 @@ test:do_execsql_test(
-- MUST_WORK_TEST collate
if 0>0 then
db("collate", "numeric", "numeric_collate")
- local function numeric_collate(lhs, rhs)
+ local function numeric_collate1(lhs, rhs)
if (lhs == rhs)
then
return 0
@@ -736,7 +736,7 @@ if 0>0 then
-- Mimic the sql 2 collation type TEXT.
db("collate", "text", "text_collate")
- local function numeric_collate(lhs, rhs)
+ local function numeric_collate2()
return X(34, "X!cmd", [=[["string","compare",["lhs"],["rhs"]]]=])
end
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 2725e6782..7a8da91b4 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -291,7 +291,7 @@ test:do_test(
test:execsql "CREATE TABLE t1(x INT primary key)"
sql = "INSERT INTO t1 VALUES("
tail = ""
- for i = 0, 199, 1 do
+ for _ = 0, 199, 1 do
sql = sql .. "(1+"
tail = tail .. ")"
end
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index fbebfab37..4eb30e59e 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1,6 +1,7 @@
#!/usr/bin/env tarantool
test = require("sqltester")
test:plan(173)
+local enable_broken_tests = false
function set_full_column_names(value)
box.space._session_settings:update('sql_full_column_names', {
@@ -1178,7 +1179,7 @@ test:do_execsql2_test(
test:do_test(
"select1-6.9.7",
function()
- x = test:execsql2 [[
+ local x = test:execsql2 [[
SELECT * FROM test1 a, (select 5, 6) LIMIT 1
]]
for i, tmp in ipairs(x) do
@@ -1196,7 +1197,7 @@ test:do_test(
test:do_test(
"select1-6.9.8",
function()
- x = test:execsql2 [[
+ local x = test:execsql2 [[
SELECT * FROM test1 a, (select 5 AS x, 6 AS y) AS b LIMIT 1
]]
for i, tmp in ipairs(x) do
@@ -1512,8 +1513,7 @@ test:do_execsql_test(
-- TODO: This test is failing because f1 is now being loaded off the
-- disk as a vdbe integer, not a string. Hence the value of f1/(f1-11)
-- changes because of rounding. Disable the test for now.
-if false
- then
+if enable_broken_tests then
test:do_execsql_test(
"select1-8.4",
[[
@@ -1969,7 +1969,7 @@ test:do_test(
START TRANSACTION;
INSERT INTO abc VALUES(1, 1, 1);
]]
- for i = 0,9,1 do
+ for _ = 0,9,1 do
test:execsql [[
INSERT INTO abc SELECT a+(select max(a) FROM abc), b+(select max(a) FROM abc), c+(select max(a) FROM abc) FROM abc;
]]
diff --git a/test/sql-tap/select2.test.lua b/test/sql-tap/select2.test.lua
index 24fad2149..5c9e4cad5 100755
--- a/test/sql-tap/select2.test.lua
+++ b/test/sql-tap/select2.test.lua
@@ -37,8 +37,8 @@ test:do_test(
local data = test:execsql "SELECT DISTINCT f1 FROM tbl1 ORDER BY f1"
for _, f1 in ipairs(data) do
table.insert(r, f1..":")
- local data = test:execsql( string.format("SELECT f2 FROM tbl1 WHERE f1=%s ORDER BY f2", f1))
- for _, f2 in ipairs(data) do
+ local d = test:execsql( string.format("SELECT f2 FROM tbl1 WHERE f1=%s ORDER BY f2", f1))
+ for _, f2 in ipairs(d) do
table.insert(r, f2)
end
end
@@ -56,8 +56,8 @@ test:do_test(
local data = test:execsql "SELECT DISTINCT f1 FROM tbl1 WHERE f1>3 AND f1<5"
for _, f1 in ipairs(data) do
table.insert(r, f1..":")
- local data = test:execsql( string.format("SELECT f2 FROM tbl1 WHERE f1=%s ORDER BY f2", f1))
- for _, f2 in ipairs(data) do
+ local d = test:execsql( string.format("SELECT f2 FROM tbl1 WHERE f1=%s ORDER BY f2", f1))
+ for _, f2 in ipairs(d) do
table.insert(r, f2)
end
end
diff --git a/test/sql-tap/select4.test.lua b/test/sql-tap/select4.test.lua
index 23cf1bf1b..26f80d57e 100755
--- a/test/sql-tap/select4.test.lua
+++ b/test/sql-tap/select4.test.lua
@@ -30,7 +30,6 @@ test:execsql [[
CREATE TABLE t1(n int primary key, log int);
START TRANSACTION;
]]
-local i, j
for i = 1, 31, 1 do
j = 0
while math.pow(2, j) < i do
diff --git a/test/sql-tap/select5.test.lua b/test/sql-tap/select5.test.lua
index d34de3139..309043448 100755
--- a/test/sql-tap/select5.test.lua
+++ b/test/sql-tap/select5.test.lua
@@ -27,7 +27,6 @@ test:execsql [[
CREATE TABLE t1(x int primary key, y int);
START TRANSACTION;
]]
-local i, j
for i = 1, 31, 1 do
j = 0
while math.pow(2, j) < i do
diff --git a/test/sql-tap/select9.test.lua b/test/sql-tap/select9.test.lua
index 1ae16a658..3a432a7a7 100755
--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(21157)
-- it is bad idea to store 20k positive test results in git
test.silent = true
@@ -60,10 +60,8 @@ function subrange(t, first, last)
end
local function test_compound_select(testname, sql, result)
- local nCol = 1
local A = box.execute(sql) --test.box(sql)
- nCol = #A.metadata
- A = A.rows
+ local nCol = #A.metadata
local nRow = #result / nCol
local compound_sql = sql
test:do_execsql_test(
@@ -274,10 +272,8 @@ test:do_execsql_test(
-- </select9-2.0>
})
-local t1_space_id = ""
-local t2_space_id = ""
-t1_space_id = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
-t2_space_id = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
+local t1_space_id = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
+local t2_space_id = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
--X(276, "X!cmd", [=[["db","eval","SELECT * from _space where name='t2'","data","\n set t2_space_id $data(id)\n"]]=])
--local function reverse(lhs, rhs)
-- return X(283, "X!cmd", [=[["string","compare",["rhs"],["lhs"]]]=])
diff --git a/test/sql-tap/selectA.test.lua b/test/sql-tap/selectA.test.lua
index 5cc69ef61..d986f233e 100755
--- a/test/sql-tap/selectA.test.lua
+++ b/test/sql-tap/selectA.test.lua
@@ -78,9 +78,6 @@ test:do_execsql_test(
})
-- MUST_WORK_TEST
-if (0 > 0)
- then
-end
test:do_execsql_test(
"selectA-2.1",
[[
@@ -2356,10 +2353,7 @@ test:do_execsql_test(
--
-- MUST_WORK_TEST
-- TODO stored procedures are not supported by now
-if (0 > 0)
- then
-end
-local function f(args)
+local function f()
return 1
end
diff --git a/test/sql-tap/selectB.test.lua b/test/sql-tap/selectB.test.lua
index 56d4b9d1b..934aa2db9 100755
--- a/test/sql-tap/selectB.test.lua
+++ b/test/sql-tap/selectB.test.lua
@@ -26,11 +26,11 @@ local function test_transform(testname, sql1, sql2, results)
local vdbe1 = { }
local vdbe2 = { }
local data = box.execute("explain "..sql1)
- for i, line in ipairs(data) do
+ for _, line in ipairs(data) do
table.insert(vdbe1, line[2])
end
data = box.execute("explain "..sql2)
- for i, line in ipairs(data) do
+ for _, line in ipairs(data) do
table.insert(vdbe2, line[2])
end
test:do_test(
@@ -211,10 +211,7 @@ test:do_execsql_test(
})
for ii = 3, 6, 1 do
- if ii == 4 then
- -- TODO
- --X(2, "X!cmd", [=[["optimization_control","db","query-flattener","off"]]=])
- elseif ii == 5 then
+ if ii == 5 then
--X(2, "X!cmd", [=[["optimization_control","db","query-flattener","on"]]=])
test:do_execsql_test(
"selectB-5.0",
@@ -231,7 +228,10 @@ for ii = 3, 6, 1 do
-- </selectB-5.0>
})
- elseif ii == 6 then
+ --elseif ii == 4 then
+ -- TODO
+ --X(2, "X!cmd", [=[["optimization_control","db","query-flattener","off"]]=])
+ --elseif ii == 6 then
--X(2, "X!cmd", [=[["optimization_control","db","query-flattener","off"]]=])
end
test:do_execsql_test(
diff --git a/test/sql-tap/selectG.test.lua b/test/sql-tap/selectG.test.lua
index 0ca066d1c..b1644190c 100755
--- a/test/sql-tap/selectG.test.lua
+++ b/test/sql-tap/selectG.test.lua
@@ -36,7 +36,6 @@ test:do_test(
function()
local sql_arr = {[[CREATE TABLE t1(x INT primary key);
INSERT INTO t1(x) VALUES]]}
- local i
for i = 1, 100000-1, 1 do
table.insert(sql_arr, "("..i.."),")
end
diff --git a/test/sql-tap/sort.test.lua b/test/sql-tap/sort.test.lua
index 36074d6ef..0ad2f4ef4 100755
--- a/test/sql-tap/sort.test.lua
+++ b/test/sql-tap/sort.test.lua
@@ -761,7 +761,7 @@ test:do_execsql_test(
--
-- MUST_WORK_TEST? special sql functions (sql_soft_heap_limit, sql_test_control...)
if (0 > 0) then
-local function cksum(x)
+local function cksum()
local i1 = 1
local i2 = 2
X(503, "X!cmd", [=[["binary","scan",["x"],"c*","L"]]=])
diff --git a/test/sql-tap/sql-errors.test.lua b/test/sql-tap/sql-errors.test.lua
index 5ec94bfe3..14294f706 100755
--- a/test/sql-tap/sql-errors.test.lua
+++ b/test/sql-tap/sql-errors.test.lua
@@ -6,7 +6,7 @@ test:execsql([[
CREATE TABLE t0 (i INT PRIMARY KEY, a INT);
CREATE VIEW v0 AS SELECT * FROM t0;
]])
-format = {}
+local format = {}
for i = 1, 2001 do format[i] = {name = 'A' .. i, type = 'unsigned'} end
s0 = box.schema.space.create('S0', {format = format})
i0 = s0:create_index('I0')
diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua
index 1b4ec1173..86d20e09f 100755
--- a/test/sql-tap/table.test.lua
+++ b/test/sql-tap/table.test.lua
@@ -1,6 +1,7 @@
#!/usr/bin/env tarantool
test = require("sqltester")
test:plan(79)
+enable_broken_tests = false
--!./tcltestrunner.lua
-- 2001 September 15
@@ -947,7 +948,7 @@ test:do_execsql_test(
--
-- Disabled until #3694 is resolved.
--
-if false then
+if enable_broken_tests then
test:do_execsql_test(
"table-13.1",
[[
diff --git a/test/sql-tap/tkt-38cb5df375.test.lua b/test/sql-tap/tkt-38cb5df375.test.lua
index a7587ef3a..32ac6fdcd 100755
--- a/test/sql-tap/tkt-38cb5df375.test.lua
+++ b/test/sql-tap/tkt-38cb5df375.test.lua
@@ -31,7 +31,6 @@ local function lrange(arr, start_num, end_num)
return tmp
end
-local ii
test:do_execsql_test(
"tkt-38cb5df375.0",
[[
diff --git a/test/sql-tap/tkt-91e2e8ba6f.test.lua b/test/sql-tap/tkt-91e2e8ba6f.test.lua
index b12b6e0f3..d1ed6a653 100755
--- a/test/sql-tap/tkt-91e2e8ba6f.test.lua
+++ b/test/sql-tap/tkt-91e2e8ba6f.test.lua
@@ -82,9 +82,6 @@ test:do_execsql_test(
})
-- MUST_WORK_TEST
-if (0 > 0)
- then
-end
test:do_execsql_test(
1.7,
[[
diff --git a/test/sql-tap/tkt-9a8b09f8e6.test.lua b/test/sql-tap/tkt-9a8b09f8e6.test.lua
index cb5348ab4..f90782cbd 100755
--- a/test/sql-tap/tkt-9a8b09f8e6.test.lua
+++ b/test/sql-tap/tkt-9a8b09f8e6.test.lua
@@ -22,9 +22,6 @@ test:plan(49)
-- ["source",[["testdir"],"\/tester.tcl"]]
testprefix = "tkt-9a8b09f8e6"
-- MUST_WORK_TEST
-if (0 > 0)
- then
-end
test:do_execsql_test(
1.1,
[[
diff --git a/test/sql-tap/tkt-bd484a090c.test.lua b/test/sql-tap/tkt-bd484a090c.test.lua
index 0347fd426..9eab5fe73 100755
--- a/test/sql-tap/tkt-bd484a090c.test.lua
+++ b/test/sql-tap/tkt-bd484a090c.test.lua
@@ -2,6 +2,7 @@
test = require("sqltester")
--test:plan(2)
test:plan(0)
+enable_broken_tests = false
--!./tcltestrunner.lua
-- 2011 June 21
@@ -22,7 +23,7 @@ testprefix = "tkt-bd484a090c"
-- Disabled until #3694 is resolved.
--
-if false then
+if enable_broken_tests then
test:do_test(
1.1,
function()
diff --git a/test/sql-tap/tkt2192.test.lua b/test/sql-tap/tkt2192.test.lua
index 52309ff2b..763cae782 100755
--- a/test/sql-tap/tkt2192.test.lua
+++ b/test/sql-tap/tkt2192.test.lua
@@ -2,6 +2,7 @@
test = require("sqltester")
-- test:plan(6)
test:plan(4)
+local enable_broken_tests = false
--!./tcltestrunner.lua
-- 2007 January 26
@@ -26,7 +27,7 @@ test:plan(4)
-- Disabled until #3694 is resolved.
--
-if false then
+if enable_broken_tests then
test:do_execsql_test(
"tkt2192-1.1",
[[
diff --git a/test/sql-tap/tkt3493.test.lua b/test/sql-tap/tkt3493.test.lua
index 7ceec4702..6ec4214db 100755
--- a/test/sql-tap/tkt3493.test.lua
+++ b/test/sql-tap/tkt3493.test.lua
@@ -255,9 +255,6 @@ test:do_execsql_test(
})
-- MUST_WORK_TEST
-if (0 > 0)
- then
-end
test:do_execsql_test(
"tkt3493-3.2.1",
[[
diff --git a/test/sql-tap/trigger2.test.lua b/test/sql-tap/trigger2.test.lua
index 192b707d3..b412e581c 100755
--- a/test/sql-tap/trigger2.test.lua
+++ b/test/sql-tap/trigger2.test.lua
@@ -126,12 +126,12 @@ for _, tbl_defn in ipairs(tbl_definitions) do
raw_result = test:execsql [[
SELECT * FROM rlog ORDER BY idx;
]]
- for k,v in pairs(raw_result) do table.insert(r, v) end
+ for _,v in pairs(raw_result) do table.insert(r, v) end
raw_result = test:execsql [[
SELECT * FROM clog ORDER BY idx;
]]
- for k,v in pairs(raw_result) do table.insert(r, v) end
+ for _,v in pairs(raw_result) do table.insert(r, v) end
return r
end, {
diff --git a/test/sql-tap/triggerA.test.lua b/test/sql-tap/triggerA.test.lua
index fac51ca14..8dfd4dfab 100755
--- a/test/sql-tap/triggerA.test.lua
+++ b/test/sql-tap/triggerA.test.lua
@@ -46,7 +46,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;
diff --git a/test/sql-tap/where2.test.lua b/test/sql-tap/where2.test.lua
index f267be8e6..838e58be6 100755
--- a/test/sql-tap/where2.test.lua
+++ b/test/sql-tap/where2.test.lua
@@ -1,9 +1,6 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
-yaml = require("yaml")
-fio = require("fio")
-
-ffi = require("ffi")
+local test = require("sqltester")
+local ffi = require("ffi")
test:plan(74)
ffi.cdef[[
@@ -115,7 +112,7 @@ local function queryplan(sql)
table.insert(data, tab)
table.insert(data, idx)
else
- as, tab = string.match(v, "TABLE (%w+ AS) (%w+)")
+ _, tab = string.match(v, "TABLE (%w+ AS) (%w+)")
if tab == nil then
tab = string.match(v, "TABLE (%w+)")
end
diff --git a/test/sql-tap/where3.test.lua b/test/sql-tap/where3.test.lua
index ae9e37f61..4a8798eeb 100755
--- a/test/sql-tap/where3.test.lua
+++ b/test/sql-tap/where3.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(83)
--!./tcltestrunner.lua
diff --git a/test/sql-tap/where4.test.lua b/test/sql-tap/where4.test.lua
index e38972666..65e7f9337 100755
--- a/test/sql-tap/where4.test.lua
+++ b/test/sql-tap/where4.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(8)
--!./tcltestrunner.lua
@@ -23,7 +23,7 @@ test:plan(8)
-- $Id: where4.test,v 1.6 2007/12/10 05:03:48 danielk1977 Exp $
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "where4"
+local testprefix = "where4"
-- Build some test data
diff --git a/test/sql-tap/where5.test.lua b/test/sql-tap/where5.test.lua
index 749201564..655c1b72b 100755
--- a/test/sql-tap/where5.test.lua
+++ b/test/sql-tap/where5.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(50)
--!./tcltestrunner.lua
diff --git a/test/sql-tap/where6.test.lua b/test/sql-tap/where6.test.lua
index 5fb79fa2a..f9de30dbc 100755
--- a/test/sql-tap/where6.test.lua
+++ b/test/sql-tap/where6.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(20)
--!./tcltestrunner.lua
diff --git a/test/sql-tap/where7.test.lua b/test/sql-tap/where7.test.lua
index 70209545d..d3e7d91fe 100755
--- a/test/sql-tap/where7.test.lua
+++ b/test/sql-tap/where7.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(2023)
--!./tcltestrunner.lua
@@ -229,7 +229,7 @@ test:do_test(
test:do_test(
"where7-1.20",
function()
- sql = "SELECT a FROM t1 WHERE a=11 OR b=11"
+ local sql = "SELECT a FROM t1 WHERE a=11 OR b=11"
for i = 12, 100 do
sql = sql .. string.format(" OR a=%s OR b=%s", i, i)
end
@@ -244,7 +244,7 @@ test:do_test(
test:do_test(
"where7-1.21",
function()
- sql = "SELECT a FROM t1 WHERE b=11 OR c=11"
+ local sql = "SELECT a FROM t1 WHERE b=11 OR c=11"
for i = 12, 100 do
sql = sql .. string.format(" OR b=%s OR c=%s", i, i)
end
@@ -259,7 +259,7 @@ test:do_test(
test:do_test(
"where7-1.22",
function()
- sql = "SELECT a FROM t1 WHERE (b=11 OR c=11"
+ local sql = "SELECT a FROM t1 WHERE (b=11 OR c=11"
for i = 12, 100 do
sql = sql .. string.format(" OR b=%s OR c=%s", i, i)
end
@@ -274,7 +274,7 @@ test:do_test(
test:do_test(
"where7-1.23",
function()
- sql = "SELECT a FROM t1 WHERE (b=11 OR c=11"
+ local sql = "SELECT a FROM t1 WHERE (b=11 OR c=11"
for i = 12, 100 do
sql = sql .. string.format(" OR (b=%s AND d!=0) OR (c=%s AND d IS NOT NULL)", i, i)
end
@@ -289,7 +289,7 @@ test:do_test(
test:do_test(
"where7-1.31",
function()
- sql = "SELECT a FROM t1 WHERE (a=11 AND b=11)"
+ local sql = "SELECT a FROM t1 WHERE (a=11 AND b=11)"
for i = 12, 100 do
sql = sql .. string.format(" OR (a=%s AND b=%s)", i, i)
end
@@ -304,7 +304,7 @@ test:do_test(
test:do_test(
"where7-1.32",
function()
- sql = "SELECT a FROM t1 WHERE (b=11 AND c=11)"
+ local sql = "SELECT a FROM t1 WHERE (b=11 AND c=11)"
for i = 12, 100 do
sql = sql .. string.format(" OR (b=%s AND c=%s)", i, i)
end
@@ -319,7 +319,7 @@ test:do_test(
test:do_test(
"where7-AST-depth-limit",
function()
- sql = "SELECT a FROM t1 WHERE a = 0"
+ local sql = "SELECT a FROM t1 WHERE a = 0"
for i = 1, 199 do
sql = sql .. string.format(" OR a = %s", i)
end
diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
index a49d1c05c..968ceb2e9 100755
--- a/test/sql-tap/whereA.test.lua
+++ b/test/sql-tap/whereA.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(17)
--!./tcltestrunner.lua
diff --git a/test/sql-tap/whereB.test.lua b/test/sql-tap/whereB.test.lua
index d98645fdc..c7ef910d1 100755
--- a/test/sql-tap/whereB.test.lua
+++ b/test/sql-tap/whereB.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(63)
--!./tcltestrunner.lua
diff --git a/test/sql-tap/whereC.test.lua b/test/sql-tap/whereC.test.lua
index 89459dee3..231404cea 100755
--- a/test/sql-tap/whereC.test.lua
+++ b/test/sql-tap/whereC.test.lua
@@ -1,6 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
-local yaml = require('yaml')
+local test = require("sqltester")
test:plan(41)
--!./tcltestrunner.lua
@@ -17,7 +16,7 @@ test:plan(41)
--
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereC"
+local testprefix = "whereC"
test:do_execsql_test(
1.0,
[[
diff --git a/test/sql-tap/whereD.test.lua b/test/sql-tap/whereD.test.lua
index 14dc8d3bd..26221ec12 100755
--- a/test/sql-tap/whereD.test.lua
+++ b/test/sql-tap/whereD.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(36)
--!./tcltestrunner.lua
@@ -19,7 +19,7 @@ test:plan(36)
--
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereD"
+local testprefix = "whereD"
test:do_execsql_test(
1.1,
[[
diff --git a/test/sql-tap/whereF.test.lua b/test/sql-tap/whereF.test.lua
index 5a894b748..64e51fbf0 100755
--- a/test/sql-tap/whereF.test.lua
+++ b/test/sql-tap/whereF.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(13)
--!./tcltestrunner.lua
@@ -48,7 +48,7 @@ test:plan(13)
--
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereF"
+local testprefix = "whereF"
test:do_execsql_test(
1.0,
[[
diff --git a/test/sql-tap/whereG.test.lua b/test/sql-tap/whereG.test.lua
index 590027023..2fbc6c5b3 100755
--- a/test/sql-tap/whereG.test.lua
+++ b/test/sql-tap/whereG.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(23)
--!./tcltestrunner.lua
@@ -18,7 +18,7 @@ test:plan(23)
-- likelihood() functions.
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereG"
+local testprefix = "whereG"
test:do_execsql_test(
"whereG-1.0",
[[
diff --git a/test/sql-tap/whereI.test.lua b/test/sql-tap/whereI.test.lua
index 3ae5b82f2..79c6bcfe5 100755
--- a/test/sql-tap/whereI.test.lua
+++ b/test/sql-tap/whereI.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(7)
--!./tcltestrunner.lua
@@ -20,7 +20,7 @@ test:plan(7)
--
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereI"
+local testprefix = "whereI"
test:do_execsql_test(1.0, [[
CREATE TABLE t1(a INT, b TEXT, c TEXT, PRIMARY KEY(a));
INSERT INTO t1 VALUES(1, 'a', 'z');
diff --git a/test/sql-tap/whereK.test.lua b/test/sql-tap/whereK.test.lua
index 58e3146a7..0ca7fff0d 100755
--- a/test/sql-tap/whereK.test.lua
+++ b/test/sql-tap/whereK.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(10)
--!./tcltestrunner.lua
@@ -23,7 +23,7 @@ test:plan(10)
--
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereK"
+local testprefix = "whereK"
test:do_execsql_test(1.1, [[
CREATE TABLE t1(a INT ,b INT ,c INT , primary key (a,b,c));
WITH RECURSIVE c(x) AS (VALUES(0) UNION ALL SELECT x+1 FROM c WHERE x<99)
diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua
index 75935108c..2a91085a2 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(64)
--!./tcltestrunner.lua
@@ -18,7 +18,7 @@ test:plan(64)
--
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "with1"
+local testprefix = "with1"
-- if X(0, "X!capable", [["!cte"]]) then
-- test:finish_test()
-- return
@@ -623,7 +623,7 @@ test:do_execsql_test("8.2-soduko", [[
-- Some tests that use LIMIT and OFFSET in the definition of recursive CTEs.
--
-- I = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }
-function limit_test(tn, iLimit, iOffset)
+local function limit_test(tn, iLimit, iOffset)
local last = 20 - 1
local result = {}
-- if X(0, "X!expr01", [["$iOffset < 0"]]) then
@@ -631,13 +631,13 @@ function limit_test(tn, iLimit, iOffset)
iOffset = 0
end
-- if X(0, "X!expr01", [["$iLimit < 0 "]]) then
- if iLimit < 0 then
- -- result = X(467, "X!cmd", [=[["lrange",["::I"],["iOffset"],"end"]]=])
- -- last is 20
- else
+ if iLimit >= 0 then
-- result = X(467, "X!cmd", [=[["lrange",["::I"],["iOffset"],[["expr",[["iLimit"],"+",["iOffset"],"-1"]]]]]=])
last = iLimit + iOffset - 1
if last > 20 then last = 20 - 1 end
+ --else
+ -- result = X(467, "X!cmd", [=[["lrange",["::I"],["iOffset"],"end"]]=])
+ -- last is 20
end
for i = iOffset, last do
diff --git a/test/sql-tap/with2.test.lua b/test/sql-tap/with2.test.lua
index 1aa39b32e..cdf1d75a2 100755
--- a/test/sql-tap/with2.test.lua
+++ b/test/sql-tap/with2.test.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
test:plan(59)
--!./tcltestrunner.lua
@@ -18,7 +18,7 @@ test:plan(59)
--
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "with2"
+local testprefix = "with2"
test:do_execsql_test(
1.0,
@@ -386,22 +386,22 @@ genstmt(255), {
-- Check that adding a WITH clause to an INSERT disables the xfer
-- optimization.
-local function do_xfer_test(test, test_func, test_name, func, exp, opts)
- local opts = opts or {}
+local function do_xfer_test(test_arg, test_func, test_name, func, exp, opts)
+ opts = opts or {}
local exp_xfer_count = opts.exp_xfer_count
local before = box.stat.sql().sql_xfer_count
- test_func(test, test_name, func, exp)
+ test_func(test_arg, test_name, func, exp)
local after = box.stat.sql().sql_xfer_count
test:is(after - before, exp_xfer_count,
test_name .. '-xfer-count')
end
-test.do_execsql_xfer_test = function(test, test_name, func, exp, opts)
- do_xfer_test(test, test.do_execsql_test, test_name, func, exp, opts)
+test.do_execsql_xfer_test = function(test_arg, test_name, func, exp, opts)
+ do_xfer_test(test_arg, test_arg.do_execsql_test, test_name, func, exp, opts)
end
-test.do_catchsql_xfer_test = function(test, test_name, func, exp, opts)
- do_xfer_test(test, test.do_catchsql_test, test_name, func, exp, opts)
+test.do_catchsql_xfer_test = function(test_arg, test_name, func, exp, opts)
+ do_xfer_test(test_arg, test_arg.do_catchsql_test, test_name, func, exp, opts)
end
test:do_execsql_test(
--
2.26.2
More information about the Tarantool-patches
mailing list