[Tarantool-patches] [PATCH v6 17/25] Fix luacheck warnings in test/sql
sergeyb at tarantool.org
sergeyb at tarantool.org
Fri May 29 18:09:26 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>
---
.luacheckrc | 2 +-
test/sql/lua/sql_tokenizer.lua | 2 +-
test/sql/savepoints.result | 6 +++---
test/sql/savepoints.test.lua | 6 +++---
test/sql/triggers.result | 2 +-
test/sql/triggers.test.lua | 2 +-
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/.luacheckrc b/.luacheckrc
index f607732a9..97efdd8c7 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -12,7 +12,7 @@ exclude_files = {
"test/engine_long/*.lua",
"test/long_run-py/**/*.lua",
"test/replication/*.test.lua",
- "test/sql/*.lua",
+ "test/sql/*.test.lua",
"test/swim/*.lua",
"test/var/**/*.lua",
"test/vinyl/*.lua",
diff --git a/test/sql/lua/sql_tokenizer.lua b/test/sql/lua/sql_tokenizer.lua
index 9922d792d..ffe4fb4e8 100644
--- a/test/sql/lua/sql_tokenizer.lua
+++ b/test/sql/lua/sql_tokenizer.lua
@@ -134,7 +134,7 @@ end
-- @retval Token type. If the rest of the SQL request consists of
-- spaces and comments, then return TK_EMPTY.
local function get_next_token(context)
- local c = ''
+ local c
repeat
local i = context.offset
c = context.sql:sub(i, i)
diff --git a/test/sql/savepoints.result b/test/sql/savepoints.result
index 509c33e59..b0915f398 100644
--- a/test/sql/savepoints.result
+++ b/test/sql/savepoints.result
@@ -102,12 +102,12 @@ collision_sv_2 = function()
box.begin()
box.execute('SAVEPOINT t1;')
box.execute('SAVEPOINT t2;')
- local _,err = box.execute('SAVEPOINT t1;')
+ local _, err = box.execute('SAVEPOINT t1;')
assert(err == nil)
box.execute('RELEASE SAVEPOINT t1;')
- local _,err = box.execute('RELEASE SAVEPOINT t1;')
+ _, err = box.execute('RELEASE SAVEPOINT t1;')
assert(err ~= nil)
- local _, err = box.execute('ROLLBACK TO t2;')
+ _, err = box.execute('ROLLBACK TO t2;')
assert(err == nil)
end;
---
diff --git a/test/sql/savepoints.test.lua b/test/sql/savepoints.test.lua
index f1b15c748..eb7bea37d 100644
--- a/test/sql/savepoints.test.lua
+++ b/test/sql/savepoints.test.lua
@@ -65,12 +65,12 @@ collision_sv_2 = function()
box.begin()
box.execute('SAVEPOINT t1;')
box.execute('SAVEPOINT t2;')
- local _,err = box.execute('SAVEPOINT t1;')
+ local _, err = box.execute('SAVEPOINT t1;')
assert(err == nil)
box.execute('RELEASE SAVEPOINT t1;')
- local _,err = box.execute('RELEASE SAVEPOINT t1;')
+ _, err = box.execute('RELEASE SAVEPOINT t1;')
assert(err ~= nil)
- local _, err = box.execute('ROLLBACK TO t2;')
+ _, err = box.execute('ROLLBACK TO t2;')
assert(err == nil)
end;
collision_sv_2();
diff --git a/test/sql/triggers.result b/test/sql/triggers.result
index ceecb8ef2..e70d72947 100644
--- a/test/sql/triggers.result
+++ b/test/sql/triggers.result
@@ -11,7 +11,7 @@ _ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
---
...
-- Get invariant part of the tuple; name and opts don't change.
- function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
+ function immutable_part(data) local r = {} for _, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
---
...
--
diff --git a/test/sql/triggers.test.lua b/test/sql/triggers.test.lua
index f5c8a3961..bc694ebc4 100644
--- a/test/sql/triggers.test.lua
+++ b/test/sql/triggers.test.lua
@@ -4,7 +4,7 @@ engine = test_run:get_cfg('engine')
_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
-- Get invariant part of the tuple; name and opts don't change.
- function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
+ function immutable_part(data) local r = {} for _, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
--
-- gh-3273: Move Triggers to server
--
2.23.0
More information about the Tarantool-patches
mailing list