From 8f3b9b44094b8e21fe6be87d9f548809e0fb7d0c Mon Sep 17 00:00:00 2001
From: Sergey Bronnikov <sergeyb@tarantool.org>
Date: Wed, 20 Jan 2021 12:44:45 +0000
Subject: [PATCH] test: fix luacheck warnings W542 in test/sql-tap

W542 (An empty if branch)

Part of #5464
---
 .luacheckrc                          | 2 --
 test/sql-tap/selectA.test.lua        | 6 ------
 test/sql-tap/selectB.test.lua        | 2 ++
 test/sql-tap/tkt-91e2e8ba6f.test.lua | 3 ---
 test/sql-tap/tkt-9a8b09f8e6.test.lua | 3 ---
 test/sql-tap/tkt3493.test.lua        | 3 ---
 test/sql-tap/with1.test.lua          | 1 +
 7 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 50fc90511a..9a4da29a2c 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -49,8 +49,6 @@ exclude_files = {
 
 files["test/sql-tap/**/*.lua"] = {
     ignore = {
-        -- An empty if branch.
-        "542",
         -- A line consists of nothing but whitespace.
         "611",
         -- A line contains trailing whitespace.
diff --git a/test/sql-tap/selectA.test.lua b/test/sql-tap/selectA.test.lua
index 9a64d77a86..6c1374e8df 100755
--- a/test/sql-tap/selectA.test.lua
+++ b/test/sql-tap/selectA.test.lua
@@ -76,9 +76,6 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-end
 test:do_execsql_test(
     "selectA-2.1",
     [[
@@ -2354,9 +2351,6 @@ test:do_execsql_test(
 --
 -- MUST_WORK_TEST
 -- TODO stored procedures are not supported by now
-if (0 > 0)
- then
-end
 local function f(args) -- luacheck: no unused
     return 1
 end
diff --git a/test/sql-tap/selectB.test.lua b/test/sql-tap/selectB.test.lua
index 6c7bc805ab..f1f43af76c 100755
--- a/test/sql-tap/selectB.test.lua
+++ b/test/sql-tap/selectB.test.lua
@@ -212,6 +212,7 @@ test:do_execsql_test(
 
 for ii = 3, 6, 1 do
     if ii == 4 then
+        assert(ii == 4) -- added to pass luacheck
         -- TODO
         --X(2, "X!cmd", [=[["optimization_control","db","query-flattener","off"]]=])
     elseif ii == 5 then
@@ -232,6 +233,7 @@ for ii = 3, 6, 1 do
             })
 
     elseif ii == 6 then
+        assert(ii == 6) -- added to pass luacheck
         --X(2, "X!cmd", [=[["optimization_control","db","query-flattener","off"]]=])
     end
     test:do_execsql_test(
diff --git a/test/sql-tap/tkt-91e2e8ba6f.test.lua b/test/sql-tap/tkt-91e2e8ba6f.test.lua
index a72b8d957c..dac546f100 100755
--- a/test/sql-tap/tkt-91e2e8ba6f.test.lua
+++ b/test/sql-tap/tkt-91e2e8ba6f.test.lua
@@ -81,9 +81,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 3fbc1ce37d..1e52463530 100755
--- a/test/sql-tap/tkt-9a8b09f8e6.test.lua
+++ b/test/sql-tap/tkt-9a8b09f8e6.test.lua
@@ -21,9 +21,6 @@ test:plan(47)
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-end
 test:do_execsql_test(
     1.1,
     [[
diff --git a/test/sql-tap/tkt3493.test.lua b/test/sql-tap/tkt3493.test.lua
index 78e465b00d..9387c52071 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/with1.test.lua b/test/sql-tap/with1.test.lua
index 89a427ecc3..32e187186c 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -631,6 +631,7 @@ local function limit_test(tn, iLimit, iOffset)
     end
     -- if X(0, "X!expr01", [["$iLimit < 0 "]]) then
     if iLimit < 0 then
+        assert(iLimit < 0) -- added to pass luacheck
         -- result = X(467, "X!cmd", [=[["lrange",["::I"],["iOffset"],"end"]]=])
         -- last is 20
     else
-- 
GitLab