[Tarantool-patches] [PATCH v8 06/14] test: fix laucheck warnings W213 in test/sql-tap

Sergey Bronnikov sergeyb at tarantool.org
Fri Jan 29 19:32:32 MSK 2021


Thanks for review!

On 24.01.2021 20:35, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> On 21.01.2021 13:50, sergeyb at tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb at tarantool.org>
>>
>> W213 (Unused loop variable)
>>
>> Part of #5464
>> ---
>> 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 0b7c3ca32..57302811b 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 i = 1, 10000 do -- luacheck: ignore unused i
> Why do you ignore it here, and replace with _ in some other places?

replaced with _ in other places too

--- 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 -- luacheck: ignore unused i
+               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-3332-tuple-format-leak.test.lua 
b/test/sql-tap/gh-3332-tuple-format-leak.test.lua
index 48c6268cf..5285cfa28 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 -- luacheck: ignore unused i
+        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 bab70b714..33d22b50a 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 = 
"<D0><90><D0><90><D0><90><D0><90><D0><90><D0><90><D0><90><D0><90><D0><90><D0><90>"

  -- Create 30kb table name
-for i=1,300 do -- luacheck: ignore unused i
+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 -- luacheck: ignore unused i
+for _=1, 300 do
         table.insert(vt, view_word)
  end

@@ -45,7 +45,7 @@ local it = {}
  local index_word = 
"<D0><95><D0><95><D0><95><D0><95><D0><95><D0><95><D0><95><D0><95><D0><95><D0><95>"

  -- Create 30kb index name
-for i=1, 300 do -- luacheck: ignore unused i
+for _=1, 300 do
         table.insert(it, index_word)
  end

@@ -55,7 +55,7 @@ local field_table = {}
  local field_word = 
'<D0><94><D0><94><D0><94><D0><94><D0><94><D0><94><D0><94><D0><94><D0><94>'

  -- Create 30kb field name
-for i=1, 300 do -- luacheck: ignore unused i
+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 = 
"<D0><A1><D0><A1><D0><A1><D0><A1><D0><A1><D0><A1><D0><A1><D0><A1><D0><A1>"

-for i=1, 300 do -- luacheck: ignore unused i
+for _=1, 300 do
         table.insert(trig_table, trigger_word)
  end


--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -272,7 +272,7 @@ test.catchsql2 = catchsql2
  -- that different SQL statements generate exactly the same VDBE code.
  local function explain_no_trace(self, sql)
      local tr = execsql(self, "EXPLAIN "..sql)
-    for i=1,8 do -- luacheck: ignore unused i
+    for _=1,8 do
          table.remove(tr,1)
      end
      return tr
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 62678bbbd..4e7f006d7 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -292,7 +292,7 @@ test:do_test(
          local sql, tail
          sql = "INSERT INTO t1 VALUES("
          tail = ""
-        for i = 0, 199, 1 do -- luacheck: ignore unused i
+        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 d1301e5ad..35fcd8aec 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1974,7 +1974,7 @@ test:do_test(
              START TRANSACTION;
              INSERT INTO abc VALUES(1, 1, 1);
          ]]
-        for i = 0,9,1 do -- luacheck: ignore unused i
+        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;
              ]]



More information about the Tarantool-patches mailing list