Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap
@ 2021-01-21 12:49 Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 01/14] test: fix luacheck warnings in test/sql Sergey Bronnikov via Tarantool-patches
                   ` (15 more replies)
  0 siblings, 16 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:49 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

Changelog v8:

- re-made patches for sql-tap suite
- removed fixes suppressed globally in .luacheckrc (like upvalue redefinitions)
- splitted huge patch to a number of patches per warning
- rebased to a master branch

Changelog v7:

- fixed warnings in a new code
- rebased to master branch

Changelog v6:

- splitted patch in test/ for patches per sub-directory
- adjusted suppressions in .luacheckrc
- fixed formatting issues in .luacheckrc

Note that a number of tests in sql-tap are broken (see suite.ini) and luacheck
fixes cannot be verified with running tests.

Gitlab CI: https://gitlab.com/tarantool/tarantool/-/pipelines/244912620
Branch: ligurio/gh-5463-luacheck-warnings-test-sql
Issues:
  - https://github.com/tarantool/tarantool/issues/5464
  - https://github.com/tarantool/tarantool/issues/5463
  - https://github.com/tarantool/tarantool/issues/5741

Sergey Bronnikov (14):
  test: fix luacheck warnings in test/sql
  test: remove functions to open and close SQL connection
  test: fix luacheck warnings W113 in test/sql-tap
  test: fix luacheck warnings W211 in test/sql-tap
  test: fix luacheck warnings W212 in test/sql-tap
  test: fix laucheck warnings W213 in test/sql-tap
  test: fix luacheck warnings W231 in test/sql-tap
  test: fix luacheck warnings W311 in test/sql-tap
  test: fix luacheck warnings W511 in test/sql-tap
  test: fix luacheck warnings W512 in test/sql-tap
  test: fix luacheck warnings W542 in test/sql-tap
  test: fix luacheck warnings W612, W613, W614 in test/sql-tap
  test: fix luacheck warnings W621 in test/sql-tap
  luacheck: add issues for suppressed warnings

 .luacheckrc                                   |  65 ++++----
 test/sql-tap/aggnested.test.lua               |   9 +-
 test/sql-tap/alias.test.lua                   |   4 +-
 test/sql-tap/alter.test.lua                   |   2 +-
 test/sql-tap/analyze1.test.lua                |   4 +-
 test/sql-tap/analyze3.test.lua                |  54 +++----
 test/sql-tap/analyze4.test.lua                |   6 +-
 test/sql-tap/analyze5.test.lua                |  22 +--
 test/sql-tap/analyze6.test.lua                |   2 -
 test/sql-tap/analyze7.test.lua                |  14 +-
 test/sql-tap/analyze8.test.lua                |  10 +-
 test/sql-tap/analyze9.test.lua                | 120 +++++++-------
 test/sql-tap/analyzeC.test.lua                |   3 -
 test/sql-tap/analyzeD.test.lua                |  24 ++-
 test/sql-tap/analyzeE.test.lua                |   2 -
 test/sql-tap/analyzeF.test.lua                |   6 +-
 test/sql-tap/atof1.test.lua                   |   2 +-
 test/sql-tap/autoinc.test.lua                 |   4 +-
 test/sql-tap/autoindex4.test.lua              |   6 +-
 test/sql-tap/badutf1.test.lua                 |  10 +-
 test/sql-tap/between.test.lua                 |   2 +-
 test/sql-tap/check.test.lua                   |   4 +-
 test/sql-tap/colname.test.lua                 |  10 +-
 test/sql-tap/contrib01.test.lua               |   4 +-
 test/sql-tap/count.test.lua                   |   1 -
 test/sql-tap/date.test.lua                    |   8 +-
 test/sql-tap/default.test.lua                 |  12 +-
 test/sql-tap/delete3.test.lua                 |   2 +-
 test/sql-tap/delete4.test.lua                 |  16 +-
 test/sql-tap/distinct.test.lua                |   7 +-
 test/sql-tap/e_delete.test.lua                |   2 +-
 test/sql-tap/e_expr.test.lua                  |  52 ++----
 test/sql-tap/e_select1.test.lua               |   8 +-
 test/sql-tap/eqp.test.lua                     |  54 +++----
 test/sql-tap/func.test.lua                    |  11 +-
 test/sql-tap/func5.test.lua                   |   2 +-
 test/sql-tap/gh-2723-concurrency.test.lua     |   8 +-
 .../gh-3083-ephemeral-unref-tuples.test.lua   |   2 +-
 .../gh-3332-tuple-format-leak.test.lua        |   2 +-
 .../gh2127-indentifier-max-length.test.lua    |  10 +-
 .../gh2250-trigger-chain-limit.test.lua       |   1 -
 test/sql-tap/icu.test.lua                     |   8 +-
 test/sql-tap/identifier-characters.test.lua   |   2 +-
 test/sql-tap/in1.test.lua                     |  48 +++---
 test/sql-tap/in2.test.lua                     |  12 +-
 test/sql-tap/in3.test.lua                     |  36 ++---
 test/sql-tap/in4.test.lua                     |  56 +++----
 test/sql-tap/in5.test.lua                     |   1 -
 test/sql-tap/index1.test.lua                  |   5 +-
 test/sql-tap/index3.test.lua                  |   6 +-
 test/sql-tap/index4.test.lua                  |  17 +-
 test/sql-tap/insert1.test.lua                 |   9 +-
 test/sql-tap/insert3.test.lua                 |   2 +-
 test/sql-tap/join.test.lua                    |  25 +--
 test/sql-tap/join3.test.lua                   |   4 +-
 test/sql-tap/join6.test.lua                   |   2 +-
 test/sql-tap/keyword1.test.lua                |   2 +-
 test/sql-tap/limit.test.lua                   |  25 ++-
 test/sql-tap/lua/sqltester.lua                |   7 +-
 test/sql-tap/lua_sql.test.lua                 |   6 +-
 test/sql-tap/minmax2.test.lua                 |   2 +
 test/sql-tap/minmax3.test.lua                 |  32 ++--
 test/sql-tap/minmax4.test.lua                 |   4 +-
 test/sql-tap/misc1.test.lua                   |  25 +--
 test/sql-tap/misc3.test.lua                   |   1 -
 test/sql-tap/misc5.test.lua                   |  55 ++++---
 test/sql-tap/null.test.lua                    |  10 +-
 test/sql-tap/numcast.test.lua                 |   2 -
 test/sql-tap/offset1.test.lua                 |   8 +-
 test/sql-tap/orderby1.test.lua                |  12 +-
 test/sql-tap/orderby2.test.lua                |   2 +-
 test/sql-tap/orderby3.test.lua                |   2 +-
 test/sql-tap/orderby4.test.lua                |   2 +-
 test/sql-tap/orderby5.test.lua                |   2 +-
 test/sql-tap/orderby6.test.lua                |  36 ++---
 test/sql-tap/orderby8.test.lua                |   1 -
 test/sql-tap/orderby9.test.lua                |   5 +-
 test/sql-tap/resolver01.test.lua              |   8 +-
 test/sql-tap/select1.test.lua                 |  59 +++----
 test/sql-tap/select3.test.lua                 |  30 ++--
 test/sql-tap/select4.test.lua                 |  32 ++--
 test/sql-tap/select5.test.lua                 |   8 +-
 test/sql-tap/select6.test.lua                 |  36 ++---
 test/sql-tap/select7.test.lua                 |   9 +-
 test/sql-tap/select8.test.lua                 |  24 +--
 test/sql-tap/select9.test.lua                 |  39 ++---
 test/sql-tap/selectA.test.lua                 |  13 --
 test/sql-tap/selectB.test.lua                 |  78 ++++-----
 test/sql-tap/selectC.test.lua                 |   6 +-
 test/sql-tap/selectE.test.lua                 |  16 +-
 test/sql-tap/selectF.test.lua                 |   9 +-
 test/sql-tap/selectG.test.lua                 |   2 -
 test/sql-tap/sort.test.lua                    |  12 +-
 test/sql-tap/subquery.test.lua                |  37 ++---
 test/sql-tap/subquery2.test.lua               |  10 +-
 test/sql-tap/subselect.test.lua               |   4 +-
 test/sql-tap/table.test.lua                   |  57 ++++---
 test/sql-tap/tkt-02a8e81d44.test.lua          |   2 +-
 test/sql-tap/tkt-31338dca7e.test.lua          |   2 +-
 test/sql-tap/tkt-385a5b56b9.test.lua          |   5 +-
 test/sql-tap/tkt-38cb5df375.test.lua          |   1 -
 test/sql-tap/tkt-3a77c9714e.test.lua          |   8 +-
 test/sql-tap/tkt-4a03edc4c8.test.lua          |   2 +-
 test/sql-tap/tkt-4dd95f6943.test.lua          |  17 +-
 test/sql-tap/tkt-4ef7e3cfca.test.lua          |   1 -
 test/sql-tap/tkt-54844eea3f.test.lua          |   7 +-
 test/sql-tap/tkt-752e1646fc.test.lua          |   8 +-
 test/sql-tap/tkt-7bbfb7d442.test.lua          |  15 +-
 test/sql-tap/tkt-80ba201079.test.lua          |   5 +-
 test/sql-tap/tkt-8c63ff0ec.test.lua           |   5 +-
 test/sql-tap/tkt-91e2e8ba6f.test.lua          |  10 +-
 test/sql-tap/tkt-9a8b09f8e6.test.lua          |   4 -
 test/sql-tap/tkt-a8a0d2996a.test.lua          |   3 +-
 test/sql-tap/tkt-b1d3a2e531.test.lua          |   3 -
 test/sql-tap/tkt-b75a9ca6b0.test.lua          |   1 -
 test/sql-tap/tkt-ba7cbfaedc.test.lua          |   5 +-
 test/sql-tap/tkt-bd484a090c.test.lua          |   6 +-
 test/sql-tap/tkt-d635236375.test.lua          |   1 -
 test/sql-tap/tkt-f973c7ac31.test.lua          |   6 +-
 test/sql-tap/tkt-fa7bf5ec.test.lua            |   6 +-
 test/sql-tap/tkt1443.test.lua                 |   9 +-
 test/sql-tap/tkt1444.test.lua                 |   2 +-
 test/sql-tap/tkt1449.test.lua                 |   2 +-
 test/sql-tap/tkt1473.test.lua                 |   8 +-
 test/sql-tap/tkt1501.test.lua                 |   2 +-
 test/sql-tap/tkt1514.test.lua                 |   2 +-
 test/sql-tap/tkt1537.test.lua                 |   2 +-
 test/sql-tap/tkt2141.test.lua                 |   2 +-
 test/sql-tap/tkt2192.test.lua                 |   7 +-
 test/sql-tap/tkt2391.test.lua                 |   4 +-
 test/sql-tap/tkt2640.test.lua                 |   2 +-
 test/sql-tap/tkt2822.test.lua                 |  46 +++---
 test/sql-tap/tkt2927.test.lua                 |  64 ++++----
 test/sql-tap/tkt2942.test.lua                 |   2 +-
 test/sql-tap/tkt3201.test.lua                 |   6 +-
 test/sql-tap/tkt3298.test.lua                 |   2 +-
 test/sql-tap/tkt3357.test.lua                 |   8 +-
 test/sql-tap/tkt3424.test.lua                 |  10 +-
 test/sql-tap/tkt3442.test.lua                 |   4 +-
 test/sql-tap/tkt3493.test.lua                 |  71 ++++----
 test/sql-tap/tkt3554.test.lua                 |   2 +-
 test/sql-tap/tkt3581.test.lua                 |   4 +-
 test/sql-tap/tkt3935.test.lua                 |  17 +-
 test/sql-tap/tokenize.test.lua                |   2 +-
 test/sql-tap/transitive1.test.lua             |   4 +-
 test/sql-tap/trigger1.test.lua                |   2 -
 test/sql-tap/trigger2.test.lua                |   4 +-
 test/sql-tap/trigger9.test.lua                |   3 +-
 test/sql-tap/triggerA.test.lua                |   2 -
 test/sql-tap/triggerB.test.lua                |  10 +-
 test/sql-tap/triggerC.test.lua                |   2 -
 test/sql-tap/types.test.lua                   |   1 -
 test/sql-tap/types2.test.lua                  |   8 +-
 test/sql-tap/update.test.lua                  |  28 ++--
 test/sql-tap/view.test.lua                    | 152 ++++++++----------
 test/sql-tap/where2.test.lua                  |  49 +++---
 test/sql-tap/where3.test.lua                  |  50 +++---
 test/sql-tap/where4.test.lua                  |  18 +--
 test/sql-tap/where6.test.lua                  |   6 +-
 test/sql-tap/where7.test.lua                  |  10 +-
 test/sql-tap/whereC.test.lua                  |   2 -
 test/sql-tap/whereD.test.lua                  |   7 +-
 test/sql-tap/whereF.test.lua                  |   9 +-
 test/sql-tap/whereG.test.lua                  |   9 +-
 test/sql-tap/whereI.test.lua                  |   7 +-
 test/sql-tap/whereK.test.lua                  |   1 -
 test/sql-tap/with1.test.lua                   |  56 +++----
 test/sql-tap/with2.test.lua                   |  41 +++--
 test/sql/lua/sql_tokenizer.lua                |   2 +-
 169 files changed, 1119 insertions(+), 1317 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 01/14] test: fix luacheck warnings in test/sql
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:49 ` Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 02/14] test: remove functions to open and close SQL connection Sergey Bronnikov via Tarantool-patches
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:49 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

Closes #5463

Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Reviewed-by: Igor Munkin <imun@tarantool.org>
---
 .luacheckrc                    | 2 +-
 test/sql/lua/sql_tokenizer.lua | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index b427f6475..81aa61a2b 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -38,7 +38,7 @@ exclude_files = {
     "test/luajit-tap/**/*.lua",
     "test/replication/**/*.lua",
     "test/replication-py/**/*.lua",
-    "test/sql/**/*.lua",
+    "test/sql/*.test.lua",
     "test/swim/**/*.lua",
     "test/var/**/*.lua",
     "test/vinyl/*.test.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)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 02/14] test: remove functions to open and close SQL connection
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 01/14] test: fix luacheck warnings in test/sql Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:49 ` Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:49 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

Part of #5464
Closes #5741
---
 test/sql-tap/aggnested.test.lua |  1 -
 test/sql-tap/autoinc.test.lua   |  2 --
 test/sql-tap/check.test.lua     |  2 --
 test/sql-tap/colname.test.lua   |  2 --
 test/sql-tap/e_expr.test.lua    |  5 -----
 test/sql-tap/eqp.test.lua       |  2 --
 test/sql-tap/index4.test.lua    |  2 --
 test/sql-tap/misc1.test.lua     |  6 ------
 test/sql-tap/misc5.test.lua     |  1 -
 test/sql-tap/numcast.test.lua   |  2 --
 test/sql-tap/sort.test.lua      |  8 --------
 test/sql-tap/table.test.lua     |  6 ------
 test/sql-tap/tkt1443.test.lua   |  1 -
 test/sql-tap/view.test.lua      | 18 ++----------------
 14 files changed, 2 insertions(+), 56 deletions(-)

diff --git a/test/sql-tap/aggnested.test.lua b/test/sql-tap/aggnested.test.lua
index 8a79e0df2..37471f48a 100755
--- a/test/sql-tap/aggnested.test.lua
+++ b/test/sql-tap/aggnested.test.lua
@@ -73,7 +73,6 @@ test:do_execsql_test("aggnested-1.4",
 -- # http://www.mail-archive.com/sql-users@sql.org/msg70787.html
 -- #
 -- do_test aggnested-2.0 {
---   sql db2 :memory:
 --   db2 eval {
 --     CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT 
 --     NULL,A4 INTEGER NOT NULL,PRIMARY KEY(A1));
diff --git a/test/sql-tap/autoinc.test.lua b/test/sql-tap/autoinc.test.lua
index 0ea1961fd..3f8000abd 100755
--- a/test/sql-tap/autoinc.test.lua
+++ b/test/sql-tap/autoinc.test.lua
@@ -52,8 +52,6 @@ test:do_execsql_test(
 -- test:do_test(
 --     "autoinc-1.4",
 --     function()
---         db("close")
---         sql("db", "test.db")
 --         return test:execsql([[
 --             SELECT * FROM _sequence;
 --         ]])
diff --git a/test/sql-tap/check.test.lua b/test/sql-tap/check.test.lua
index cd9f24796..6ecfedeb8 100755
--- a/test/sql-tap/check.test.lua
+++ b/test/sql-tap/check.test.lua
@@ -227,8 +227,6 @@ test:do_execsql_test(
         -- </check-2.2>
     })
 
---db("close")
---sql("db", "test.db")
 test:do_execsql_test(
     "check-2.3",
     [[
diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua
index 191396bcc..44fa4cf89 100755
--- a/test/sql-tap/colname.test.lua
+++ b/test/sql-tap/colname.test.lua
@@ -435,8 +435,6 @@ test:do_execsql2_test(
 test:do_test(
     "colname-6.1",
     function()
-        --db("close")
-        --sql("db", "test.db")
         -- instead of reconnect to database
         -- we are just turning settings to default state
         test:execsql([[
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index f5b58cb79..81b08e223 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -2170,8 +2170,6 @@ test:do_test(
         "def", "abc", "X"
         -- </e_expr-15.1.4>
     })
---db("close")
---sql("db", "test.db")
 -- EVIDENCE-OF: R-22868-25880 The LIKE operator can be made case
 -- sensitive using the case_sensitive_like pragma.
 --
@@ -3245,9 +3243,6 @@ end
 ---------------------------------------------------------------------------
 -- Test statements related to scalar sub-queries.
 --
--- catch { db close }
--- forcedelete test.db
--- sql db test.db
 test:catchsql "DROP TABLE t22;"
 test:do_execsql_test(
     "e_expr-35.0",
diff --git a/test/sql-tap/eqp.test.lua b/test/sql-tap/eqp.test.lua
index 6519fc4e9..6f08ca089 100755
--- a/test/sql-tap/eqp.test.lua
+++ b/test/sql-tap/eqp.test.lua
@@ -754,8 +754,6 @@ if (0 > 0)
            ANALYZE;
         ]])
 
-    --db("close")
-    --sql("db", "test.db")
     test:do_eqp_test("7.4", "SELECT count(*) FROM t1", {
        {0, 0, 0, "SCAN TABLE T1"}
    })
diff --git a/test/sql-tap/index4.test.lua b/test/sql-tap/index4.test.lua
index 4ea713a58..1019e0c89 100755
--- a/test/sql-tap/index4.test.lua
+++ b/test/sql-tap/index4.test.lua
@@ -58,8 +58,6 @@ test:do_execsql_test(
 
 -- MUST_WORK_TEST limit memory
 --soft_limit = sql_soft_heap_limit(50000)
---db("close")
---sql("db", "test.db")
 --test:do_execsql_test(
 --    1.4,
 --    [[
diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
index c9b9cd7a8..7d928bea0 100755
--- a/test/sql-tap/misc1.test.lua
+++ b/test/sql-tap/misc1.test.lua
@@ -1062,8 +1062,6 @@ test:do_catchsql_test(
 
 -- # 2015-04-19: NULL pointer dereference on a corrupt schema
 -- #
--- db close
--- sql db :memory:
 -- do_execsql_test misc1-23.1 {
 --   CREATE TABLE t1(x INT );
 --   UPDATE sql_master SET sql='CREATE table t(d CHECK(T(#0)';
@@ -1074,9 +1072,7 @@ test:do_catchsql_test(
 -- } {}
 -- # 2015-04-19:  Faulty assert() statement
 -- #
--- db close
 -- database_may_be_corrupt
--- sql db :memory:
 -- do_catchsql_test misc1-23.2 {
 --   CREATE TABLE t1(x  INT UNIQUE);
 --   UPDATE sql_master SET sql='CREATE TABLE IF not EXISTS t(c)';
@@ -1085,8 +1081,6 @@ test:do_catchsql_test(
 --   ROLLBACK;
 --   DROP TABLE F;
 -- } {1 {no such table: F}}
--- db close
--- sql db :memory:
 -- do_catchsql_test misc1-23.3 {
 --   CREATE TABLE t1(x  INT UNIQUE);
 --   UPDATE sql_master SET sql='CREATE table y(a TEXT, a TEXT)';
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 357c36ff6..4bc18aa87 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -308,7 +308,6 @@ test:do_test(
 -- # schema.
 -- #
 -- do_test misc5-7.2 {
---   sql db2 :memory:
 --   catchsql {
 --     CREATE TABLE t1(x  INT UNIQUE);
 --     UPDATE sql_master SET sql='CREATE table t(o CHECK(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((;VALUES(o)';
diff --git a/test/sql-tap/numcast.test.lua b/test/sql-tap/numcast.test.lua
index 18c6adc9e..6ca1316d5 100755
--- a/test/sql-tap/numcast.test.lua
+++ b/test/sql-tap/numcast.test.lua
@@ -26,8 +26,6 @@ for _, enc in ipairs({"utf8"}) do
     test:do_test(
         "numcast-"..enc..".0",
         function()
-            --db("close")
-            --sql("db", ":memory:")
             --test:execsql("PRAGMA encoding='"..enc.."'")
             local x = "utf8"--test:execsql("PRAGMA encoding")[1]
             x = string.lower(x)
diff --git a/test/sql-tap/sort.test.lua b/test/sql-tap/sort.test.lua
index 065f648b7..5a951b0e9 100755
--- a/test/sql-tap/sort.test.lua
+++ b/test/sql-tap/sort.test.lua
@@ -805,8 +805,6 @@ box.internal.sql_create_function("cksum", cksum)
     ---------------------------------------------------------------------------
     --
     for _ in X(0, "X!foreach", [=[["tn mmap_limit nWorker tmpstore coremutex fakeheap softheaplimit","\n             1          0       3     file      true    false             0\n             2          0       3     file      true     true             0\n             3          0       0     file      true    false             0\n             4    1000000       3     file      true    false             0\n             5          0       0   memory     false     true             0\n             6          0       0     file     false     true       1000000     \n             7          0       0     file     false     true         10000\n   "]]=]) do
-        db("close")
-        sql_shutdown()
         if coremutex then
             sql_config("multithread")
         else
@@ -815,7 +813,6 @@ box.internal.sql_create_function("cksum", cksum)
         sql_initialize()
         X(558, "X!cmd", [=[["sorter_test_fakeheap",["fakeheap"]]]=])
         sql_soft_heap_limit(softheaplimit)
-        reset_db()
         sql_test_control("sql_TESTCTRL_SORTER_MMAP", "db", mmap_limit)
         test:execsql(string.format("PRAGMA temp_store = %s; PRAGMA threads = '%s'", tmpstore, nWorker))
         local ten, one
@@ -870,15 +867,12 @@ box.internal.sql_create_function("cksum", cksum)
 
         X(605, "X!cmd", [=[["sorter_test_fakeheap","0"]]=])
     end
-    db("close")
-    sql_shutdown()
     X(617, "X!cmd", [=[["set","t(0)","singlethread"]]=])
     X(618, "X!cmd", [=[["set","t(1)","multithread"]]=])
     X(619, "X!cmd", [=[["set","t(2)","serialized"]]=])
     sql_config(X(620, "X!expr", [=[["t($sql_options(threadsafe))"]]=]))
     sql_initialize()
     sql_soft_heap_limit(0)
-    reset_db()
     test:do_catchsql_test(
         16.1,
         [[
@@ -895,7 +889,6 @@ box.internal.sql_create_function("cksum", cksum)
             -- </16.1>
         })
 
-    reset_db()
     test:do_catchsql_test(
         16.2,
         [[
@@ -912,7 +905,6 @@ box.internal.sql_create_function("cksum", cksum)
             -- </16.2>
         })
 
-    reset_db()
     test:do_execsql_test(
         17.1,
         [[
diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua
index 590dbafbd..6e45dbab1 100755
--- a/test/sql-tap/table.test.lua
+++ b/test/sql-tap/table.test.lua
@@ -422,9 +422,6 @@ if (0 > 0)
     test:do_test(
         "table-5.2.2",
         function()
-            db("close")
-            forcedelete("test.db")
-            sql("db", "test.db")
             return test:execsql [[
                 CREATE TABLE t0(a,b);
                 CREATE INDEX t ON t0(a);
@@ -440,9 +437,6 @@ if (0 > 0)
             -- </table-5.2.2>
         })
 
-    db("close")
-    forcedelete("test.db")
-    sql("db", "test.db")
     X(313, "X!cmd", [=[["Make","sure","an","EXPLAIN","does","not","really","create","a","new","table"]]=])
 end
 test:do_test(
diff --git a/test/sql-tap/tkt1443.test.lua b/test/sql-tap/tkt1443.test.lua
index f0776285f..d1d837e72 100755
--- a/test/sql-tap/tkt1443.test.lua
+++ b/test/sql-tap/tkt1443.test.lua
@@ -50,7 +50,6 @@ test:plan(3)
 test:do_test(
     "tkt1443-1.0",
     function()
-        --sql("db", ":memory:")
         return test:execsql(string.format([[
             CREATE TABLE Items(
                 itemId integer primary key,
diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua
index 4d85d8bcb..2f1af29b0 100755
--- a/test/sql-tap/view.test.lua
+++ b/test/sql-tap/view.test.lua
@@ -88,8 +88,6 @@ test:do_execsql_test(
 test:do_test(
     "view-1.3.1",
     function()
-        --db("close")
-        --sql("db", "test.db")
         return test:execsql [[
             SELECT * FROM v1 ORDER BY a;
         ]]
@@ -502,14 +500,12 @@ test:do_execsql_test(
         -- </view-7.1>
     })
 
--- MUST_WORK_TEST db close problem
+-- MUST_WORK_TEST
 if (0 > 0)
  then
     test:do_test(
         "view-7.2",
         function()
-            db("close")
-            sql("db", "test.db")
             return test:execsql [[
                 SELECT * FROM test;
             ]]
@@ -540,8 +536,6 @@ if (0 > 0)
     test:do_test(
         "view-7.4",
         function()
-            db("close")
-            sql("db", "test.db")
             return test:execsql [[
                 SELECT * FROM test;
             ]]
@@ -572,8 +566,6 @@ if (0 > 0)
     test:do_test(
         "view-7.6",
         function()
-            db("close")
-            sql("db", "test.db")
             return test:execsql [[
                 SELECT * FROM test;
             ]]
@@ -595,14 +587,12 @@ test:do_execsql_test(
         -- </view-8.1>
     })
 
--- MUST_WORK_TEST db close
+-- MUST_WORK_TEST
 if (0 > 0)
  then
     test:do_test(
         "view-8.2",
         function()
-            db("close")
-            sql("db", "test.db")
             return test:execsql [[
                 SELECT * FROM v6 ORDER BY xyz;
             ]]
@@ -1068,8 +1058,6 @@ test:do_execsql_test(
 if (0 > 0)
  then
     -- Ticket #d58ccbb3f1b"]],":"],"Prevent","Table.nRef","overflow.
-    --db("close")
-    --sql("db", ":memory:")
     test:execsql([[
         drop view v1;
         drop view v2;
@@ -1120,8 +1108,6 @@ if (0 > 0)
 
 
 
-    --db("close")
-    --sql("db", ":memory:")
     test:do_execsql_test(
         "view-22.1",
         [[
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 01/14] test: fix luacheck warnings in test/sql Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 02/14] test: remove functions to open and close SQL connection Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:49 ` Sergey Bronnikov via Tarantool-patches
  2021-01-24 17:33   ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-26 23:42   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 " Sergey Bronnikov via Tarantool-patches
                   ` (12 subsequent siblings)
  15 siblings, 2 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:49 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W113 (Accessing an undefined global variable)

Part of #5464
---
 .luacheckrc                    |  37 +++++++++-
 test/sql-tap/badutf1.test.lua  |  10 ++-
 test/sql-tap/index1.test.lua   |   2 +-
 test/sql-tap/lua/sqltester.lua |   2 +-
 test/sql-tap/lua_sql.test.lua  |   6 +-
 test/sql-tap/minmax2.test.lua  |   2 +
 test/sql-tap/select1.test.lua  |   4 ++
 test/sql-tap/subquery.test.lua |   7 +-
 test/sql-tap/table.test.lua    |   6 +-
 test/sql-tap/tkt1443.test.lua  |   2 +-
 test/sql-tap/trigger9.test.lua |   1 +
 test/sql-tap/triggerC.test.lua |   1 -
 test/sql-tap/view.test.lua     | 126 +++++++++++++++------------------
 13 files changed, 122 insertions(+), 84 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 81aa61a2b..eb709d6a3 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,6 @@ exclude_files = {
 
 files["test/sql-tap/**/*.lua"] = {
     ignore = {
-        -- Accessing an undefined global variable.
-        "113",
         -- Unused local variable.
         "211",
         -- Unused argument.
@@ -124,3 +122,38 @@ files["test/box-tap/extended_error.test.lua"] = {
         "forbidden_function",
     },
 }
+files["test/sql-tap/analyze5.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/cast.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/func.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/e_expr.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/e_select1.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/misc1.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/sort.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
diff --git a/test/sql-tap/badutf1.test.lua b/test/sql-tap/badutf1.test.lua
index 654629bf7..b7fa8ce0b 100755
--- a/test/sql-tap/badutf1.test.lua
+++ b/test/sql-tap/badutf1.test.lua
@@ -93,8 +93,12 @@ test:do_test(
     })
 
 -- commented as it uses utf16
-if 0>0 then
-sql("db2", "")
+-- testcases are broken
+-- https://github.com/tarantool/tarantool/issues/5743
+local is_gh_5743_closed = false
+if is_gh_5743_closed then
+sql("db2", "") -- luacheck: ignore sql
+-- luacheck: push ignore sql_exec
 test:do_test(
     "badutf-1.10",
     function()
@@ -206,7 +210,7 @@ test:do_test(
         -- </badutf-1.20>
     })
 end
-
+-- luacheck: pop
 
 
 test:do_test(
diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
index ea25727a4..574faafd6 100755
--- a/test/sql-tap/index1.test.lua
+++ b/test/sql-tap/index1.test.lua
@@ -585,7 +585,7 @@ test:do_test(
         for i = 1, 50, 1 do
             test:execsql(string.format("INSERT INTO t3 VALUES('x%sx',%s,0.%s)", i, i, i))
         end
-        local sql_search_count = 0
+        -- luacheck: ignore X
         return X(381, "X!cmd", [=[["concat",[["execsql","SELECT c FROM t3 WHERE b==10"]],["sql_search_count"]]]=])
     end, {
         -- <index-11.1>
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 169d2f271..bfd14a1a7 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -86,7 +86,7 @@ local function is_deeply_regex(got, expected)
     end
 
     if string_regex_p(expected) then
-        return table_match_regex_p(got, expected)
+        return table_match_regex_p(got, expected) -- luacheck: ignore table_match_regex_p
     end
 
     if got == nil and expected == nil then return true end
diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
index b22f195ca..4704970c8 100755
--- a/test/sql-tap/lua_sql.test.lua
+++ b/test/sql-tap/lua_sql.test.lua
@@ -75,9 +75,10 @@ box.schema.func.create('CHECK_FROM_SQL_TO_LUA', {language = 'Lua',
                        exports = {'LUA', 'SQL'}})
 
 -- check for different types
-for i = 1, #from_sql_to_lua, 1 do
+for i = 1, #from_sql_to_lua, 1 do -- luacheck: ignore from_sql_to_lua
     test:do_execsql_test(
         "lua_sql-2.2."..i,
+        -- luacheck: ignore from_sql_to_lua
         "select check_from_sql_to_lua("..i..","..from_sql_to_lua[i][1]..")",
         {1})
 end
@@ -102,9 +103,10 @@ box.schema.func.create('CHECK_FROM_LUA_TO_SQL', {language = 'Lua',
                        exports = {'LUA', 'SQL'}})
 
 -- check for different types
-for i = 1, #from_lua_to_sql, 1 do
+for i = 1, #from_lua_to_sql, 1 do -- luacheck: ignore from_lua_to_sql
     test:do_execsql_test(
         "lua_sql-2.3."..i,
+        -- luacheck: ignore from_lua_to_sql
         "select "..tostring(from_lua_to_sql[i][1]).." = check_from_lua_to_sql("..i..")",
         {true})
 end
diff --git a/test/sql-tap/minmax2.test.lua b/test/sql-tap/minmax2.test.lua
index f3d608aab..b6c02a4cc 100755
--- a/test/sql-tap/minmax2.test.lua
+++ b/test/sql-tap/minmax2.test.lua
@@ -72,6 +72,7 @@ test:do_test(
 test:do_test(
     "minmax2-1.2",
     function()
+        -- luacheck: ignore sql_search_count
         return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
@@ -89,6 +90,7 @@ test:do_test(
 test:do_test(
     "minmax2-1.4",
     function()
+        -- luacheck: ignore sql_search_count
         return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index 0e7c5a318..99bcce93b 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1556,6 +1556,7 @@ test:do_test(
         return box.execute("SELECT * FROM test1 WHERE f1<0").metadata
     end, {
         -- <select1-9.2>
+        -- luacheck: ignore F1 and F2 and INTEGER
         {name = F1, type = INTEGER},{name = F2, type = INTEGER}
         -- </select1-9.2>
     })
@@ -1566,6 +1567,7 @@ test:do_test(
             return box.execute("SELECT * FROM test1 WHERE f1<(select count(*) from test2)").metadata
         end, {
             -- <select1-9.3>
+            -- luacheck: ignore F1 and F2 and INTEGER
             {name = F1, type = INTEGER},{name = F2, type = INTEGER}
             -- </select1-9.3>
         })
@@ -1578,6 +1580,7 @@ test:do_test(
         return box.execute("SELECT * FROM test1 ORDER BY f1").metadata
     end, {
         -- <select1-9.4>
+        -- luacheck: ignore F1 and F2 and INTEGER
         {name = F1, type = INTEGER},{name = F2, type = INTEGER}
         -- </select1-9.4>
     })
@@ -1588,6 +1591,7 @@ test:do_test(
         return box.execute("SELECT * FROM test1 WHERE f1<0 ORDER BY f1").metadata
     end, {
         -- <select1-9.5>
+        -- luacheck: ignore F1 and F2 and INTEGER
         {name = F1, type = INTEGER},{name = F2, type = INTEGER}
         -- </select1-9.5>
     })
diff --git a/test/sql-tap/subquery.test.lua b/test/sql-tap/subquery.test.lua
index f57a22624..2f92da96c 100755
--- a/test/sql-tap/subquery.test.lua
+++ b/test/sql-tap/subquery.test.lua
@@ -684,7 +684,7 @@ test:do_test(
         -- This is the key test.  The subquery should have only run once.  If
         -- The double-quoted identifier "two" were causing the subquery to be
         -- processed as a correlated subquery, then it would have run 4 times.
-        return callcnt
+        return callcnt -- luacheck: ignore callcnt
     end, 1)
 
 -- Ticket #1380.  Make sure correlated subqueries on an IN clause work
@@ -706,7 +706,8 @@ test:do_test(
 test:do_test(
     "subquery-6.2",
     function()
-        return callcnt
+        return callcnt -- luacheck: ignore callcnt
+
     end, 4)
 
 test:do_test(
@@ -725,7 +726,7 @@ test:do_test(
 test:do_test(
     "subquery-6.4",
     function()
-        return callcnt
+        return callcnt -- luacheck: ignore callcnt
     end, 1)
 
 box.func.CALLCNT:drop()
diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua
index 6e45dbab1..2817e1e72 100755
--- a/test/sql-tap/table.test.lua
+++ b/test/sql-tap/table.test.lua
@@ -417,7 +417,10 @@ test:do_test(
 
 test:drop_all_tables()
 -- MUST_WORK_TEST
-if (0 > 0)
+-- testcase is broken
+-- https://github.com/tarantool/tarantool/issues/5742
+local is_gh_5742_closed = false
+if is_gh_5742_closed
  then
     test:do_test(
         "table-5.2.2",
@@ -437,6 +440,7 @@ if (0 > 0)
             -- </table-5.2.2>
         })
 
+    -- luacheck: ignore X
     X(313, "X!cmd", [=[["Make","sure","an","EXPLAIN","does","not","really","create","a","new","table"]]=])
 end
 test:do_test(
diff --git a/test/sql-tap/tkt1443.test.lua b/test/sql-tap/tkt1443.test.lua
index d1d837e72..f40ca16d1 100755
--- a/test/sql-tap/tkt1443.test.lua
+++ b/test/sql-tap/tkt1443.test.lua
@@ -115,7 +115,7 @@ test:do_test(
             );
             INSERT INTO Permissions VALUES(1, 0, 0, 1, 0, 1);
             INSERT INTO Permissions VALUES(2, 2, 4, 0, 0, 0);
-        ]], d))
+        ]], d)) -- luacheck: ignore d
     end, {
         -- <tkt1443-1.0>
 
diff --git a/test/sql-tap/trigger9.test.lua b/test/sql-tap/trigger9.test.lua
index 5c1f4cbb2..b8e1fc876 100755
--- a/test/sql-tap/trigger9.test.lua
+++ b/test/sql-tap/trigger9.test.lua
@@ -1,5 +1,6 @@
 #!/usr/bin/env tarantool
 _G.test = require("sqltester")
+local test = _G.test
 test:plan(28)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua
index e95641938..7d496bc4d 100755
--- a/test/sql-tap/triggerC.test.lua
+++ b/test/sql-tap/triggerC.test.lua
@@ -791,7 +791,6 @@ for testno, v in ipairs(tests11) do
                 SELECT a,b FROM log;
             ]]
         end, {
-            defaults
         })
 
     --
diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua
index 2f1af29b0..67f461132 100755
--- a/test/sql-tap/view.test.lua
+++ b/test/sql-tap/view.test.lua
@@ -1,6 +1,6 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-test:plan(78)
+test:plan(83)
 
 --!./tcltestrunner.lua
 -- 2002 February 26
@@ -501,21 +501,18 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-    test:do_test(
-        "view-7.2",
-        function()
-            return test:execsql [[
-                SELECT * FROM test;
-            ]]
-        end, {
-            -- <view-7.2>
-            1, 2, 3
-            -- </view-7.2>
-        })
+test:do_test(
+    "view-7.2",
+    function()
+        return test:execsql [[
+            SELECT * FROM test;
+        ]]
+    end, {
+        -- <view-7.2>
+        1, 2, 3
+        -- </view-7.2>
+    })
 
-end
 test:do_execsql_test(
     "view-7.3",
     [[
@@ -531,21 +528,18 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-    test:do_test(
-        "view-7.4",
-        function()
-            return test:execsql [[
-                SELECT * FROM test;
-            ]]
-        end, {
-            -- <view-7.4>
-            1, 2, 3
-            -- </view-7.4>
-        })
+test:do_test(
+    "view-7.4",
+    function()
+        return test:execsql [[
+            SELECT * FROM test;
+        ]]
+    end, {
+        -- <view-7.4>
+        1, 2, 3
+        -- </view-7.4>
+    })
 
-end
 test:do_execsql_test(
     "view-7.5",
     [[
@@ -561,21 +555,18 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-    test:do_test(
-        "view-7.6",
-        function()
-            return test:execsql [[
-                SELECT * FROM test;
-            ]]
-        end, {
-            -- <view-7.6>
-            1, 2, 3
-            -- </view-7.6>
-        })
+test:do_test(
+    "view-7.6",
+    function()
+        return test:execsql [[
+            SELECT * FROM test;
+        ]]
+    end, {
+        -- <view-7.6>
+        1, 2, 3
+        -- </view-7.6>
+    })
 
-end
 test:do_execsql_test(
     "view-8.1",
     [[
@@ -588,33 +579,29 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-    test:do_test(
-        "view-8.2",
-        function()
-            return test:execsql [[
-                SELECT * FROM v6 ORDER BY xyz;
-            ]]
-        end, {
-            -- <view-8.2>
-            7, 2, 13, 5, 19, 8, 27, 12
-            -- </view-8.2>
-        })
-
-    -- MUST_WORK_TEST problem with column names
-    test:do_execsql_test(
-        "view-8.3",
-        [[
-            CREATE VIEW v7(a) AS SELECT pqr+xyz FROM v6;
-            SELECT * FROM v7 ORDER BY a;
-        ]], {
-            -- <view-8.3>
-            9, 18, 27, 39
-            -- </view-8.3>
-        })
+test:do_test(
+    "view-8.2",
+    function()
+        return test:execsql [[
+            SELECT * FROM v6 ORDER BY xyz;
+        ]]
+    end, {
+        -- <view-8.2>
+        7, 2, 13, 5, 19, 8, 27, 12
+        -- </view-8.2>
+    })
 
-end
+-- MUST_WORK_TEST problem with column names
+test:do_execsql_test(
+    "view-8.3",
+    [[
+        CREATE VIEW v7(a) AS SELECT pqr+xyz FROM v6;
+        SELECT * FROM v7 ORDER BY a;
+    ]], {
+        -- <view-8.3>
+        9, 18, 27, 39
+        -- </view-8.3>
+    })
 
 test:do_execsql_test(
     "view-8.4",
@@ -1124,6 +1111,7 @@ if (0 > 0)
         function()
             -- ["unset","-nocomplain","x"]
             test:execsql("SELECT * FROM x1 x break")
+            -- luacheck: ignore X
             return X(797, "X!cmd", [=[["lsort",[["array","names","x"]]]]=])
         end, {
             -- <view-22.2>
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (2 preceding siblings ...)
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:49 ` Sergey Bronnikov via Tarantool-patches
  2021-01-24 17:34   ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-23 21:26   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 05/14] test: fix luacheck warnings W212 " Sergey Bronnikov via Tarantool-patches
                   ` (11 subsequent siblings)
  15 siblings, 2 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:49 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W211 (Unused local variable)

Part of #5464

test: fix luacheck warnings W111 in test/sql-tap
---
 .luacheckrc                                      |  2 --
 test/sql-tap/analyze3.test.lua                   |  2 --
 test/sql-tap/analyze5.test.lua                   | 16 ----------------
 test/sql-tap/analyze6.test.lua                   |  2 --
 test/sql-tap/analyze8.test.lua                   |  2 --
 test/sql-tap/analyze9.test.lua                   |  2 --
 test/sql-tap/analyzeC.test.lua                   |  3 ---
 test/sql-tap/analyzeD.test.lua                   |  2 --
 test/sql-tap/analyzeE.test.lua                   |  2 --
 test/sql-tap/analyzeF.test.lua                   |  2 --
 test/sql-tap/check.test.lua                      |  2 +-
 test/sql-tap/colname.test.lua                    |  2 +-
 test/sql-tap/count.test.lua                      |  1 -
 test/sql-tap/date.test.lua                       |  1 -
 test/sql-tap/delete4.test.lua                    |  2 +-
 test/sql-tap/distinct.test.lua                   |  1 -
 test/sql-tap/e_expr.test.lua                     |  5 ++---
 test/sql-tap/e_select1.test.lua                  |  4 +---
 test/sql-tap/eqp.test.lua                        |  2 --
 test/sql-tap/func.test.lua                       | 11 ++---------
 test/sql-tap/gh2250-trigger-chain-limit.test.lua |  1 -
 test/sql-tap/in3.test.lua                        |  2 +-
 test/sql-tap/in5.test.lua                        |  1 -
 test/sql-tap/index1.test.lua                     |  1 -
 test/sql-tap/index4.test.lua                     |  1 -
 test/sql-tap/insert1.test.lua                    |  1 -
 test/sql-tap/limit.test.lua                      |  1 -
 test/sql-tap/lua/sqltester.lua                   |  1 -
 test/sql-tap/misc1.test.lua                      | 11 -----------
 test/sql-tap/misc3.test.lua                      |  1 -
 test/sql-tap/orderby1.test.lua                   |  2 +-
 test/sql-tap/orderby2.test.lua                   |  2 +-
 test/sql-tap/orderby3.test.lua                   |  2 +-
 test/sql-tap/orderby4.test.lua                   |  2 +-
 test/sql-tap/orderby5.test.lua                   |  2 +-
 test/sql-tap/orderby6.test.lua                   |  2 +-
 test/sql-tap/orderby8.test.lua                   |  1 -
 test/sql-tap/orderby9.test.lua                   |  1 -
 test/sql-tap/select4.test.lua                    |  2 +-
 test/sql-tap/select5.test.lua                    |  2 +-
 test/sql-tap/select6.test.lua                    |  4 +---
 test/sql-tap/select7.test.lua                    |  1 -
 test/sql-tap/select9.test.lua                    |  8 ++------
 test/sql-tap/selectA.test.lua                    |  5 -----
 test/sql-tap/selectF.test.lua                    |  1 -
 test/sql-tap/selectG.test.lua                    |  2 --
 test/sql-tap/sort.test.lua                       |  2 --
 test/sql-tap/subquery2.test.lua                  |  2 --
 test/sql-tap/tkt-385a5b56b9.test.lua             |  1 -
 test/sql-tap/tkt-38cb5df375.test.lua             |  1 -
 test/sql-tap/tkt-3a77c9714e.test.lua             |  2 --
 test/sql-tap/tkt-4dd95f6943.test.lua             |  1 -
 test/sql-tap/tkt-4ef7e3cfca.test.lua             |  1 -
 test/sql-tap/tkt-54844eea3f.test.lua             |  1 -
 test/sql-tap/tkt-7bbfb7d442.test.lua             |  1 -
 test/sql-tap/tkt-80ba201079.test.lua             |  1 -
 test/sql-tap/tkt-8c63ff0ec.test.lua              |  1 -
 test/sql-tap/tkt-91e2e8ba6f.test.lua             |  1 -
 test/sql-tap/tkt-9a8b09f8e6.test.lua             |  1 -
 test/sql-tap/tkt-a8a0d2996a.test.lua             |  1 -
 test/sql-tap/tkt-b1d3a2e531.test.lua             |  3 ---
 test/sql-tap/tkt-b75a9ca6b0.test.lua             |  1 -
 test/sql-tap/tkt-ba7cbfaedc.test.lua             |  1 -
 test/sql-tap/tkt-bd484a090c.test.lua             |  1 -
 test/sql-tap/tkt-d635236375.test.lua             |  1 -
 test/sql-tap/trigger1.test.lua                   |  2 --
 test/sql-tap/trigger9.test.lua                   |  2 --
 test/sql-tap/triggerA.test.lua                   |  1 -
 test/sql-tap/triggerC.test.lua                   |  1 -
 test/sql-tap/types.test.lua                      |  1 -
 test/sql-tap/where2.test.lua                     | 13 -------------
 test/sql-tap/where4.test.lua                     |  2 --
 test/sql-tap/whereC.test.lua                     |  2 --
 test/sql-tap/whereD.test.lua                     |  1 -
 test/sql-tap/whereF.test.lua                     |  1 -
 test/sql-tap/whereG.test.lua                     |  1 -
 test/sql-tap/whereI.test.lua                     |  1 -
 test/sql-tap/whereK.test.lua                     |  1 -
 test/sql-tap/with1.test.lua                      |  1 -
 test/sql-tap/with2.test.lua                      |  1 -
 80 files changed, 20 insertions(+), 161 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index eb709d6a3..9098d7112 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,6 @@ exclude_files = {
 
 files["test/sql-tap/**/*.lua"] = {
     ignore = {
-        -- Unused local variable.
-        "211",
         -- Unused argument.
         "212",
         -- Unused loop variable.
diff --git a/test/sql-tap/analyze3.test.lua b/test/sql-tap/analyze3.test.lua
index c36cfc83b..5f0b24fea 100755
--- a/test/sql-tap/analyze3.test.lua
+++ b/test/sql-tap/analyze3.test.lua
@@ -2,8 +2,6 @@
 local test = require("sqltester")
 test:plan(37)
 
-local testprefix = "analyze3"
-
 --!./tcltestrunner.lua
 -- 2009 August 06
 --
diff --git a/test/sql-tap/analyze5.test.lua b/test/sql-tap/analyze5.test.lua
index 1d6665ad0..d53648919 100755
--- a/test/sql-tap/analyze5.test.lua
+++ b/test/sql-tap/analyze5.test.lua
@@ -21,22 +21,6 @@ local json = require("json")
 -- with many repeated values and only a few distinct values.
 --
 
-local testprefix = "analyze5"
-local function eqp(sql)
-    return test:execsql("EXPLAIN QUERY PLAN"..sql)
-end
-
-local function alpha(blob)
-    local ret = ""
-    for _, c in ipairs(X(37, "X!cmd", [=[["split",["blob"],""]]=])) do
-        if X(39, "X!cmd", [=[["string","is","alpha",["c"]]]=])
- then
-            ret = ret .. c
-        end
-    end
-    return ret
-end
-
 -- db("func", "alpha", "alpha")
 -- db("func", "lindex", "lindex")
 -- ["unset","-nocomplain","i","t","u","v","w","x","y","z"]
diff --git a/test/sql-tap/analyze6.test.lua b/test/sql-tap/analyze6.test.lua
index 5ec40d22b..07e8aff4b 100755
--- a/test/sql-tap/analyze6.test.lua
+++ b/test/sql-tap/analyze6.test.lua
@@ -21,8 +21,6 @@ test:plan(13)
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 
-local testprefix = "analyze6"
-
 test:do_test(
     "analyze6-1.0",
     function()
diff --git a/test/sql-tap/analyze8.test.lua b/test/sql-tap/analyze8.test.lua
index 5c80a7b2f..cf40ce7bb 100755
--- a/test/sql-tap/analyze8.test.lua
+++ b/test/sql-tap/analyze8.test.lua
@@ -18,8 +18,6 @@ test:plan(15)
 -- in this file is testing the capabilities of sql_stat3.
 --
 
-local testprefix = "analyze8"
-
 -- Scenario:
 --
 --    Two indices.  One has mostly singleton entries, but for a few
diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 1d7c8b632..775b02587 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -2,8 +2,6 @@
 local test = require("sqltester")
 test:plan(121)
 
-local testprefix = "analyze9"
-
 --!./tcltestrunner.lua
 -- 2013 August 3
 --
diff --git a/test/sql-tap/analyzeC.test.lua b/test/sql-tap/analyzeC.test.lua
index baae809a6..1f303a9ce 100755
--- a/test/sql-tap/analyzeC.test.lua
+++ b/test/sql-tap/analyzeC.test.lua
@@ -2,9 +2,6 @@
 local test = require("sqltester")
 test:plan(20)
 
-local testprefix = "analyzeC"
-
-
 --!./tcltestrunner.lua
 -- 2014-07-22
 --
diff --git a/test/sql-tap/analyzeD.test.lua b/test/sql-tap/analyzeD.test.lua
index 579cb350a..12722a3d4 100755
--- a/test/sql-tap/analyzeD.test.lua
+++ b/test/sql-tap/analyzeD.test.lua
@@ -2,8 +2,6 @@
 local test = require("sqltester")
 test:plan(15)
 
-local testprefix = "analyzeD"
-
 --!./tcltestrunner.lua
 -- 2005 July 22
 --
diff --git a/test/sql-tap/analyzeE.test.lua b/test/sql-tap/analyzeE.test.lua
index 2da0c885f..22257f642 100755
--- a/test/sql-tap/analyzeE.test.lua
+++ b/test/sql-tap/analyzeE.test.lua
@@ -2,8 +2,6 @@
 local test = require("sqltester")
 test:plan(48)
 
-local testprefix = "analyzeE"
-
 --!./tcltestrunner.lua
 -- 2014-10-08
 --
diff --git a/test/sql-tap/analyzeF.test.lua b/test/sql-tap/analyzeF.test.lua
index e56437902..19bb2176f 100755
--- a/test/sql-tap/analyzeF.test.lua
+++ b/test/sql-tap/analyzeF.test.lua
@@ -2,8 +2,6 @@
 local test = require("sqltester")
 test:plan(18)
 
-local testprefix = "analyzeF"
-
 --!./tcltestrunner.lua
 -- 2015-03-12
 --
diff --git a/test/sql-tap/check.test.lua b/test/sql-tap/check.test.lua
index 6ecfedeb8..f8dcb7f7b 100755
--- a/test/sql-tap/check.test.lua
+++ b/test/sql-tap/check.test.lua
@@ -19,7 +19,7 @@ test:plan(61)
 -- $Id: check.test,v 1.13 2009/06/05 17:09:12 drh Exp $
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "check"
+
 -- Only run these tests if the build includes support for CHECK constraints
 
 
diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua
index 44fa4cf89..dd93eed21 100755
--- a/test/sql-tap/colname.test.lua
+++ b/test/sql-tap/colname.test.lua
@@ -35,7 +35,7 @@ test:plan(79)
 --
 -- Verify the default settings for full_column_name
 --
-local function lreplace(arr, pos, len, val)
+local function lreplace(arr, pos, len, val) -- luacheck: no unused
     for i = pos + 1, pos + len + 1, 1 do
         arr[i] = val
     end
diff --git a/test/sql-tap/count.test.lua b/test/sql-tap/count.test.lua
index 9f4d759b5..d019105f9 100755
--- a/test/sql-tap/count.test.lua
+++ b/test/sql-tap/count.test.lua
@@ -105,7 +105,6 @@ for _, zIndex in ipairs(queries) do
         })
 
 end
-local json = require("json")
 local function uses_op_count(sql)
     if test:lsearch(test:execsql("EXPLAIN "..sql), "Count")>0 then
         return 1
diff --git a/test/sql-tap/date.test.lua b/test/sql-tap/date.test.lua
index b414b5397..fe5150719 100755
--- a/test/sql-tap/date.test.lua
+++ b/test/sql-tap/date.test.lua
@@ -40,7 +40,6 @@ local function datetest(tnum, expr, result)
         result)
 end
 
-local tcl_precision = 15
 datetest(1.1, "julianday('2000-01-01')", "2451544.5")
 datetest(1.2, "julianday('1970-01-01')", "2440587.5")
 datetest(1.3, "julianday('1910-04-20')", "2418781.5")
diff --git a/test/sql-tap/delete4.test.lua b/test/sql-tap/delete4.test.lua
index 43585e603..14bdac151 100755
--- a/test/sql-tap/delete4.test.lua
+++ b/test/sql-tap/delete4.test.lua
@@ -18,7 +18,7 @@ test:plan(14)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "delete4"
+
 test:do_execsql_test(
     1.1,
     [[
diff --git a/test/sql-tap/distinct.test.lua b/test/sql-tap/distinct.test.lua
index 02fe8a426..3b5bf550c 100755
--- a/test/sql-tap/distinct.test.lua
+++ b/test/sql-tap/distinct.test.lua
@@ -19,7 +19,6 @@ test:plan(56)
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 
-local testprefix = "distinct"
 local function is_distinct_noop(sql)
     local sql1 = sql
     local sql2 = string.gsub(sql, "DISTINCT", "")
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index 81b08e223..f29b26175 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -1080,7 +1080,6 @@ if (0>0) then
     local function parameter_test(tn, sql, params, result)
         local stmt = sql_prepare_v2("db", sql, -1)
         for _ in X(0, "X!foreach", [=[["number name",["params"]]]=]) do
-            local nm = sql_bind_parameter_name(stmt, number)
             X(480, "X!cmd", [=[["do_test",[["tn"],".name.",["number"]],[["list","set","",["nm"]]],["name"]]]=])
             sql_bind_int(stmt, number, ((-1) * number))
         end
@@ -1089,7 +1088,7 @@ if (0>0) then
         for _ in X(0, "X!for", [=[["set i 0","$i < [sql_column_count $stmt]","incr i"]]=]) do
             table.insert(res,sql_column_text(stmt, i))
         end
-        local rc = sql_finalize(stmt)
+        sql_finalize(stmt)
         X(491, "X!cmd", [=[["do_test",[["tn"],".rc"],[["list","set","",["rc"]]],"sql_OK"]]=])
         X(492, "X!cmd", [=[["do_test",[["tn"],".res"],[["list","set","",["res"]]],["result"]]]=])
     end
@@ -1400,7 +1399,7 @@ for _, val in ipairs(test_cases12) do
         test:do_test(
             string.format("e_expr-12.3.%s.%s", tn, x),
             function()
-                local rc, err = pcall( function()
+                local rc = pcall( function()
                     test:execsql("SELECT "..e.." FROM tblname")
                 end)
                 return rc
diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua
index 2a189582d..66eaa5339 100755
--- a/test/sql-tap/e_select1.test.lua
+++ b/test/sql-tap/e_select1.test.lua
@@ -970,7 +970,7 @@ for _ in X(0, "X!foreach", [=[["tn select","\n  8.1  \"SELECT count(*) FROM a1\"
  do
         nRow = nRow + 1
     end
-    local rc = sql_finalize(stmt)
+    sql_finalize(stmt)
     -- Test that $nRow==1 and that statement execution was successful
     -- (rc==sql_OK).
     X(983, "X!cmd", [=[["do_test",["e_select-4.",["tn"]],[["list","list",["rc"],["nRow"]]],"sql_OK 1"]]=])
@@ -1421,7 +1421,6 @@ data = {
     {23, "SELECT * FROM j1 INTERSECT SELECT * FROM j2,j3 LIMIT 10 OFFSET 5"},
     {24, "SELECT a FROM j1 INTERSECT SELECT g FROM j2,j3 LIMIT (SELECT 10)"}
 }
-local json = require("json")
 for _, val in ipairs(data) do
     local tn = val[1]
     local select = val[2]
@@ -2165,7 +2164,6 @@ for _, val in ipairs({
     {"5", "SELECT b FROM f1 ORDER BY a LIMIT (SELECT group_concat(b) FROM f1)"}}) do
     local tn = val[1]
     local select = val[2]
-    local err_param = val[3]
     test:do_catchsql_test(
         "e_select-9.2."..tn,
         select,
diff --git a/test/sql-tap/eqp.test.lua b/test/sql-tap/eqp.test.lua
index 6f08ca089..bc46a920e 100755
--- a/test/sql-tap/eqp.test.lua
+++ b/test/sql-tap/eqp.test.lua
@@ -17,8 +17,6 @@ test:plan(70)
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 
-
-local testprefix = "eqp"
 ---------------------------------------------------------------------------
 --
 -- eqp-1.*:        Assorted tests.
diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
index d14eef421..4229b0098 100755
--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -18,7 +18,7 @@ test:plan(14694)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "func"
+
 -- Create a table to work with.
 --
 test:do_test(
@@ -1048,7 +1048,7 @@ test:do_execsql_test(
 --
 -- MUST_WORK_TEST testfunc not implemented
 if 0 > 0 then
-local DB = sql_connection_pointer("db")
+sql_connection_pointer("db")
 X(525, "X!cmd", [=[["sql_register_test_function",["::DB"],"testfunc"]]=])
 test:do_catchsql_test(
     "func-10.1",
@@ -1349,7 +1349,6 @@ test:do_execsql_test(
         -- </13.8.3>
     })
 
-local V = "one"
 test:do_execsql_test(
     "13.8.4",
     [[
@@ -1360,7 +1359,6 @@ test:do_execsql_test(
         -- </13.8.4>
     })
 
-V = "two"
 test:do_execsql_test(
     "13.8.5",
     [[
@@ -1372,7 +1370,6 @@ test:do_execsql_test(
     })
 
 db("cache", "flush")
-V = "three"
 test:do_execsql_test(
     "13.8.6",
     [[
@@ -1473,10 +1470,6 @@ test:do_test(
 test:do_test(
     "func-17.1",
     function()
-        local function testfunc1(args)
-            X(768, "X!cmd", [=[["error","Error %d with %s percents %p"]]=])
-        end
-
         db("function", "testfunc1", "::testfunc1")
         return test:catchsql([[
             SELECT testfunc1(1,2,3);
diff --git a/test/sql-tap/gh2250-trigger-chain-limit.test.lua b/test/sql-tap/gh2250-trigger-chain-limit.test.lua
index d3e90539a..46f80cd9a 100755
--- a/test/sql-tap/gh2250-trigger-chain-limit.test.lua
+++ b/test/sql-tap/gh2250-trigger-chain-limit.test.lua
@@ -74,7 +74,6 @@ for _, table_count in ipairs({30, 31}) do
     end
 
     local function check(sql)
-        local msg = ''
         local _, msg = pcall(function () test:execsql(sql) end)
         msg = tostring(msg)
         test:do_test(sql,
diff --git a/test/sql-tap/in3.test.lua b/test/sql-tap/in3.test.lua
index 7358f0a20..1dcf7c8e3 100755
--- a/test/sql-tap/in3.test.lua
+++ b/test/sql-tap/in3.test.lua
@@ -26,7 +26,7 @@ test:plan(28)
 -- Return the number of OpenEphemeral instructions used in the
 -- implementation of the sql statement passed as a an argument.
 --
-local function nEphemeral(sql)
+local function nEphemeral(sql) -- luacheck: no unused
     local nEph = 0
     for _, op in ipairs(test:execsql("EXPLAIN "..sql.."")) do
         if (op == "OpenTEphemeral")
diff --git a/test/sql-tap/in5.test.lua b/test/sql-tap/in5.test.lua
index a4972fc10..e441437c7 100755
--- a/test/sql-tap/in5.test.lua
+++ b/test/sql-tap/in5.test.lua
@@ -16,7 +16,6 @@ test:plan(22)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "in5"
 test:do_execsql_test(
     "in5-1.1",
     [[
diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
index 574faafd6..1ac02d60c 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)
diff --git a/test/sql-tap/index4.test.lua b/test/sql-tap/index4.test.lua
index 1019e0c89..cdc975e12 100755
--- a/test/sql-tap/index4.test.lua
+++ b/test/sql-tap/index4.test.lua
@@ -18,7 +18,6 @@ test:plan(7)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "index4"
 test:do_execsql_test(
     1.1,
     [[
diff --git a/test/sql-tap/insert1.test.lua b/test/sql-tap/insert1.test.lua
index 75dbe92b0..094fae0e9 100755
--- a/test/sql-tap/insert1.test.lua
+++ b/test/sql-tap/insert1.test.lua
@@ -1,6 +1,5 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-local yaml = require('yaml')
 test:plan(28)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/limit.test.lua b/test/sql-tap/limit.test.lua
index 4871e43db..a1b24ab19 100755
--- a/test/sql-tap/limit.test.lua
+++ b/test/sql-tap/limit.test.lua
@@ -694,7 +694,6 @@ test:do_catchsql_test(
 test:do_test(
     "limit-10.1",
     function()
-        local limit = 10
         return test:execsql [[
             SELECT x FROM t1 LIMIT 10;
         ]]
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index bfd14a1a7..53d3c2514 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -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 7d928bea0..b1c4f026b 100755
--- a/test/sql-tap/misc1.test.lua
+++ b/test/sql-tap/misc1.test.lua
@@ -726,19 +726,8 @@ test:do_execsql_test(
 -- MUST_WORK_TEST collate
 if 0>0 then
     db("collate", "numeric", "numeric_collate")
-    local function numeric_collate(lhs, rhs)
-        if (lhs == rhs)
-        then
-            return 0
-        end
-        return X(0, "X!expr", [=[["?:",[">",["lhs"],["rhs"]],3,["-",1]]]=])
-    end
-
     -- Mimic the sql 2 collation type TEXT.
     db("collate", "text", "text_collate")
-    local function numeric_collate(lhs, rhs)
-        return X(34, "X!cmd", [=[["string","compare",["lhs"],["rhs"]]]=])
-    end
 
 test:do_execsql_test(
     "misc1-12.11",
diff --git a/test/sql-tap/misc3.test.lua b/test/sql-tap/misc3.test.lua
index f27e83745..d4dac324b 100755
--- a/test/sql-tap/misc3.test.lua
+++ b/test/sql-tap/misc3.test.lua
@@ -1,6 +1,5 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-local json = require("json")
 test:plan(34)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/orderby1.test.lua b/test/sql-tap/orderby1.test.lua
index cc65360c4..f2b0fa06e 100755
--- a/test/sql-tap/orderby1.test.lua
+++ b/test/sql-tap/orderby1.test.lua
@@ -19,7 +19,7 @@ test:plan(35)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "orderby1"
+
 -- MUST_WORK_TEST
 -- # Generate test data for a join.  Verify that the join gets the
 -- # correct answer.
diff --git a/test/sql-tap/orderby2.test.lua b/test/sql-tap/orderby2.test.lua
index 03f5b3cee..3759b77bd 100755
--- a/test/sql-tap/orderby2.test.lua
+++ b/test/sql-tap/orderby2.test.lua
@@ -19,7 +19,7 @@ test:plan(9)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "orderby2"
+
 -- Generate test data for a join.  Verify that the join gets the
 -- correct answer.
 --
diff --git a/test/sql-tap/orderby3.test.lua b/test/sql-tap/orderby3.test.lua
index 6cbccf2e7..cf07bd3e7 100755
--- a/test/sql-tap/orderby3.test.lua
+++ b/test/sql-tap/orderby3.test.lua
@@ -20,7 +20,7 @@ test:plan(15)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "orderby3"
+
 -- Generate test data for a join.  Verify that the join gets the
 -- correct answer.
 --
diff --git a/test/sql-tap/orderby4.test.lua b/test/sql-tap/orderby4.test.lua
index 87f011e0a..9bcb630ef 100755
--- a/test/sql-tap/orderby4.test.lua
+++ b/test/sql-tap/orderby4.test.lua
@@ -21,7 +21,7 @@ test:plan(6)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "orderby4"
+
 -- Generate test data for a join.  Verify that the join gets the
 -- correct answer.
 --
diff --git a/test/sql-tap/orderby5.test.lua b/test/sql-tap/orderby5.test.lua
index 0a1b69cfd..519c0ef5f 100755
--- a/test/sql-tap/orderby5.test.lua
+++ b/test/sql-tap/orderby5.test.lua
@@ -19,7 +19,7 @@ test:plan(10)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "orderby5"
+
 -- Generate test data for a join.  Verify that the join gets the
 -- correct answer.
 --
diff --git a/test/sql-tap/orderby6.test.lua b/test/sql-tap/orderby6.test.lua
index cc8879ae6..8d4a0507b 100755
--- a/test/sql-tap/orderby6.test.lua
+++ b/test/sql-tap/orderby6.test.lua
@@ -26,7 +26,7 @@ test:plan(34)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "orderby6"
+
 -- Run all tests twice.  Once with a normal table and a second time
 -- with a WITHOUT ROWID table
 --
diff --git a/test/sql-tap/orderby8.test.lua b/test/sql-tap/orderby8.test.lua
index dc0101769..e6b9bf7b9 100755
--- a/test/sql-tap/orderby8.test.lua
+++ b/test/sql-tap/orderby8.test.lua
@@ -22,7 +22,6 @@ test:plan(203)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "orderby8"
 
 local rs = ""
 test:do_test(
diff --git a/test/sql-tap/orderby9.test.lua b/test/sql-tap/orderby9.test.lua
index 1fad72ddd..6957ed098 100755
--- a/test/sql-tap/orderby9.test.lua
+++ b/test/sql-tap/orderby9.test.lua
@@ -22,7 +22,6 @@ test:plan(4)
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 
-local testprefix = "orderby9"
 test:do_execsql_test(
     "setup",
     [[
diff --git a/test/sql-tap/select4.test.lua b/test/sql-tap/select4.test.lua
index abc95a24f..e2b13090d 100755
--- a/test/sql-tap/select4.test.lua
+++ b/test/sql-tap/select4.test.lua
@@ -30,7 +30,7 @@ test:execsql [[
     CREATE TABLE t1(n int primary key, log int);
     START TRANSACTION;
 ]]
-local i, j
+local 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 d531cbcf8..2902def37 100755
--- a/test/sql-tap/select5.test.lua
+++ b/test/sql-tap/select5.test.lua
@@ -27,7 +27,7 @@ test:execsql [[
     CREATE TABLE t1(x int primary key, y int);
     START TRANSACTION;
 ]]
-local i, j
+local j
 for i = 1, 31, 1 do
     j = 0
     while math.pow(2, j) < i do
diff --git a/test/sql-tap/select6.test.lua b/test/sql-tap/select6.test.lua
index 47c2ff5ef..82505f034 100755
--- a/test/sql-tap/select6.test.lua
+++ b/test/sql-tap/select6.test.lua
@@ -22,8 +22,6 @@ test:plan(88)
 -- ["source",[["testdir"],"\/tester.tcl"]]
 -- Omit this whole file if the library is build without subquery support.
 
-
-local testprefix = "select6"
 test:do_test(
     "select6-1.0",
     function()
@@ -665,7 +663,7 @@ local json = require("json")
 local function is_flat(sql)
     local r = test:execsql("EXPLAIN "..sql)
     r = json.encode(r)
-    local i, j = string.find(r,"OpenEphemeral")
+    local i = string.find(r,"OpenEphemeral")
     -- return 1 if there is no OpenEphemeral in r
     return i == nil and {1} or {0}
 end
diff --git a/test/sql-tap/select7.test.lua b/test/sql-tap/select7.test.lua
index 67edc5db3..7ff1f76d5 100755
--- a/test/sql-tap/select7.test.lua
+++ b/test/sql-tap/select7.test.lua
@@ -18,7 +18,6 @@ test:plan(18)
 -- $Id: select7.test,v 1.11 2007/09/12 17:01:45 danielk1977 Exp $
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "select7"
 -- A 3-way INTERSECT.  Ticket #875
 test:do_execsql_test(
     "select7-1.1",
diff --git a/test/sql-tap/select9.test.lua b/test/sql-tap/select9.test.lua
index 4f7da84e2..045d0e4c8 100755
--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -274,10 +274,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 _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
+local _ = 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"]]]=])
@@ -289,7 +287,6 @@ t2_space_id = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
 -- to them. Sometimes the WHERE clause may be satisfied using the same
 -- index used for ORDER BY, sometimes not.
 --
-local recreate_i1 = "DROP INDEX i1 ON t1; CREATE INDEX i1 ON t1(b, a)"
 iOuterLoop = 1
 for _, indexes in ipairs({ [[
   /* Do not create any indexes. */
@@ -480,7 +477,6 @@ test:do_execsql_test(
 --
 -- For additional information.
 --
-local json = require('json')
 test:do_test(
     "select9-5.1",
     function()
diff --git a/test/sql-tap/selectA.test.lua b/test/sql-tap/selectA.test.lua
index a608ab093..db4d03985 100755
--- a/test/sql-tap/selectA.test.lua
+++ b/test/sql-tap/selectA.test.lua
@@ -25,8 +25,6 @@ test:plan(194)
 -- $Id: selectA.test,v 1.6 2008/08/21 14:24:29 drh Exp $
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "selectA"
-
 
 test:do_execsql_test(
     "selectA-1.0",
@@ -2359,9 +2357,6 @@ test:do_execsql_test(
 if (0 > 0)
  then
 end
-local function f(args)
-    return 1
-end
 
 -- TODO stored procedures are not supported by now
 --db("func", "f", "f")
diff --git a/test/sql-tap/selectF.test.lua b/test/sql-tap/selectF.test.lua
index dbd9dfdad..2a86a4da8 100755
--- a/test/sql-tap/selectF.test.lua
+++ b/test/sql-tap/selectF.test.lua
@@ -20,7 +20,6 @@ test:plan(2)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "selectF"
 test:do_execsql_test(
     1,
     [[
diff --git a/test/sql-tap/selectG.test.lua b/test/sql-tap/selectG.test.lua
index a9c7d9fb6..d416381bd 100755
--- a/test/sql-tap/selectG.test.lua
+++ b/test/sql-tap/selectG.test.lua
@@ -19,7 +19,6 @@ test:plan(1)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "selectG"
 -- Do an INSERT with a VALUES clause that contains 100,000 entries.  Verify
 -- that this insert happens quickly (in less than 10 seconds).  Actually, the
 -- insert will normally happen in less than 0.5 seconds on a workstation, but
@@ -36,7 +35,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 5a951b0e9..a11522741 100755
--- a/test/sql-tap/sort.test.lua
+++ b/test/sql-tap/sort.test.lua
@@ -19,7 +19,6 @@ test:plan(60)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "sort"
 -- Create a bunch of data to sort against
 --
 test:do_test(
@@ -794,7 +793,6 @@ box.internal.sql_create_function("cksum", cksum)
             "sort-14."..tn,
             function()
                 sql_test_control("sql_TESTCTRL_SORTER_MMAP", "db", mmap_limit)
-                local prev = ""
                 X(536, "X!cmd", [=[["db","eval"," SELECT * FROM t11 ORDER BY b ","\n         if {$b != [cksum $a]} {error \"checksum failed\"}\n         if {[string compare $b $prev] < 0} {error \"sort failed\"}\n         set prev $b\n       "]]=])
                 return X(541, "X!cmd", [=[["set","",""]]=])
             end, {
diff --git a/test/sql-tap/subquery2.test.lua b/test/sql-tap/subquery2.test.lua
index 5cd1afa86..92fe33d04 100755
--- a/test/sql-tap/subquery2.test.lua
+++ b/test/sql-tap/subquery2.test.lua
@@ -19,8 +19,6 @@ test:plan(11)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "subquery2"
-
 
 test:do_test(
     "subquery2-1.1",
diff --git a/test/sql-tap/tkt-385a5b56b9.test.lua b/test/sql-tap/tkt-385a5b56b9.test.lua
index d10c3152e..fe314e802 100755
--- a/test/sql-tap/tkt-385a5b56b9.test.lua
+++ b/test/sql-tap/tkt-385a5b56b9.test.lua
@@ -17,7 +17,6 @@ test:plan(9)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-385a5b56b9"
 test:do_execsql_test(
     "1.0",
     [[
diff --git a/test/sql-tap/tkt-38cb5df375.test.lua b/test/sql-tap/tkt-38cb5df375.test.lua
index 1539005b8..b373bbc57 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-3a77c9714e.test.lua b/test/sql-tap/tkt-3a77c9714e.test.lua
index 82225ce89..b529d32bc 100755
--- a/test/sql-tap/tkt-3a77c9714e.test.lua
+++ b/test/sql-tap/tkt-3a77c9714e.test.lua
@@ -20,8 +20,6 @@ test:plan(4)
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 
-
-local testprefix = "tkt-3a77c9714e"
 test:do_execsql_test(
     1.1,
     [[
diff --git a/test/sql-tap/tkt-4dd95f6943.test.lua b/test/sql-tap/tkt-4dd95f6943.test.lua
index c1d862a9d..5f6077d2a 100755
--- a/test/sql-tap/tkt-4dd95f6943.test.lua
+++ b/test/sql-tap/tkt-4dd95f6943.test.lua
@@ -17,7 +17,6 @@ test:plan(319)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-4dd95f6943"
 test:do_execsql_test(
     1.0,
     [[
diff --git a/test/sql-tap/tkt-4ef7e3cfca.test.lua b/test/sql-tap/tkt-4ef7e3cfca.test.lua
index 9b02d42b7..a97079e74 100755
--- a/test/sql-tap/tkt-4ef7e3cfca.test.lua
+++ b/test/sql-tap/tkt-4ef7e3cfca.test.lua
@@ -19,7 +19,6 @@ test:plan(5)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-4ef7e3cfca"
 
 test:do_catchsql_test(
     1.1,
diff --git a/test/sql-tap/tkt-54844eea3f.test.lua b/test/sql-tap/tkt-54844eea3f.test.lua
index 042436c61..bfb94507c 100755
--- a/test/sql-tap/tkt-54844eea3f.test.lua
+++ b/test/sql-tap/tkt-54844eea3f.test.lua
@@ -18,7 +18,6 @@ test:plan(3)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-54844eea3f"
 test:do_execsql_test(
     "1.0",
     [[
diff --git a/test/sql-tap/tkt-7bbfb7d442.test.lua b/test/sql-tap/tkt-7bbfb7d442.test.lua
index 43537d229..1a748217d 100755
--- a/test/sql-tap/tkt-7bbfb7d442.test.lua
+++ b/test/sql-tap/tkt-7bbfb7d442.test.lua
@@ -20,7 +20,6 @@ test:plan(5)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-7bbfb7d442"
 -- MUST_WORK_TEST
 if (1 > 0)
  then
diff --git a/test/sql-tap/tkt-80ba201079.test.lua b/test/sql-tap/tkt-80ba201079.test.lua
index 296bfe074..7b961aacd 100755
--- a/test/sql-tap/tkt-80ba201079.test.lua
+++ b/test/sql-tap/tkt-80ba201079.test.lua
@@ -22,7 +22,6 @@ test:plan(11)
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 
-local testprefix = "tkt-80ba201079"
 test:do_test(
     "tkt-80ba2-100",
     function()
diff --git a/test/sql-tap/tkt-8c63ff0ec.test.lua b/test/sql-tap/tkt-8c63ff0ec.test.lua
index 776407ac2..3473b9105 100755
--- a/test/sql-tap/tkt-8c63ff0ec.test.lua
+++ b/test/sql-tap/tkt-8c63ff0ec.test.lua
@@ -20,7 +20,6 @@ test:plan(3)
 -- 
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-8c63ff0ec"
 test:do_execsql_test(
     1.1,
     [[
diff --git a/test/sql-tap/tkt-91e2e8ba6f.test.lua b/test/sql-tap/tkt-91e2e8ba6f.test.lua
index c6d9a26d8..a72b8d957 100755
--- a/test/sql-tap/tkt-91e2e8ba6f.test.lua
+++ b/test/sql-tap/tkt-91e2e8ba6f.test.lua
@@ -17,7 +17,6 @@ test:plan(7)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-91e2e8ba6f"
 test:do_execsql_test(
     1.1,
     [[
diff --git a/test/sql-tap/tkt-9a8b09f8e6.test.lua b/test/sql-tap/tkt-9a8b09f8e6.test.lua
index 8f305e444..3fbc1ce37 100755
--- a/test/sql-tap/tkt-9a8b09f8e6.test.lua
+++ b/test/sql-tap/tkt-9a8b09f8e6.test.lua
@@ -20,7 +20,6 @@ test:plan(47)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-9a8b09f8e6"
 -- MUST_WORK_TEST
 if (0 > 0)
  then
diff --git a/test/sql-tap/tkt-a8a0d2996a.test.lua b/test/sql-tap/tkt-a8a0d2996a.test.lua
index 3b824106b..4878f8436 100755
--- a/test/sql-tap/tkt-a8a0d2996a.test.lua
+++ b/test/sql-tap/tkt-a8a0d2996a.test.lua
@@ -19,7 +19,6 @@ test:plan(12)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-a8a0d2996a"
 test:do_execsql_test(
     1.0,
     [[
diff --git a/test/sql-tap/tkt-b1d3a2e531.test.lua b/test/sql-tap/tkt-b1d3a2e531.test.lua
index f10f14a24..d1d47d705 100755
--- a/test/sql-tap/tkt-b1d3a2e531.test.lua
+++ b/test/sql-tap/tkt-b1d3a2e531.test.lua
@@ -21,9 +21,6 @@ test:plan(11)
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 
-
-local testprefix = "tkt-b1d3a2e531"
-
 test:do_execsql_test(
     1.1,
     [[
diff --git a/test/sql-tap/tkt-b75a9ca6b0.test.lua b/test/sql-tap/tkt-b75a9ca6b0.test.lua
index cc0374357..1bce3805d 100755
--- a/test/sql-tap/tkt-b75a9ca6b0.test.lua
+++ b/test/sql-tap/tkt-b75a9ca6b0.test.lua
@@ -23,7 +23,6 @@ test:plan(20)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-b75a9ca6b0"
 test:do_execsql_test(
     1,
     [[
diff --git a/test/sql-tap/tkt-ba7cbfaedc.test.lua b/test/sql-tap/tkt-ba7cbfaedc.test.lua
index b214e9f0e..7ceda9270 100755
--- a/test/sql-tap/tkt-ba7cbfaedc.test.lua
+++ b/test/sql-tap/tkt-ba7cbfaedc.test.lua
@@ -18,7 +18,6 @@ test:plan(19)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-ba7cbfaedc"
 test:do_execsql_test(
     1,
     [[
diff --git a/test/sql-tap/tkt-bd484a090c.test.lua b/test/sql-tap/tkt-bd484a090c.test.lua
index 50c76304c..6187fee7f 100755
--- a/test/sql-tap/tkt-bd484a090c.test.lua
+++ b/test/sql-tap/tkt-bd484a090c.test.lua
@@ -18,7 +18,6 @@ test:plan(0)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-bd484a090c"
 
 -- Disabled until #3694 is resolved.
 --
diff --git a/test/sql-tap/tkt-d635236375.test.lua b/test/sql-tap/tkt-d635236375.test.lua
index 1b3e94f82..52f16c20e 100755
--- a/test/sql-tap/tkt-d635236375.test.lua
+++ b/test/sql-tap/tkt-d635236375.test.lua
@@ -19,7 +19,6 @@ test:plan(2)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "tkt-d635236375"
 test:do_execsql_test(
     1.0,
     [[
diff --git a/test/sql-tap/trigger1.test.lua b/test/sql-tap/trigger1.test.lua
index 8224ef1ec..0efdd21bc 100755
--- a/test/sql-tap/trigger1.test.lua
+++ b/test/sql-tap/trigger1.test.lua
@@ -482,8 +482,6 @@ test:execsql [[
 -- trigger works.  Then drop the trigger.  Make sure the table is
 -- still there.
 --
-local view_v1 = "view v1"
-
 
 -- do_test trigger1-6.1 {
 --   execsql {SELECT type, name FROM sql_master}
diff --git a/test/sql-tap/trigger9.test.lua b/test/sql-tap/trigger9.test.lua
index b8e1fc876..89b5b89ef 100755
--- a/test/sql-tap/trigger9.test.lua
+++ b/test/sql-tap/trigger9.test.lua
@@ -34,8 +34,6 @@ test:plan(28)
 -- ["source",[["testdir"],"\/tester.tcl"]]
 
 
-local testprefix = "trigger9"
-
 local function has_rowdata(sql)
     local result = test:execsql('EXPLAIN '..sql)
 
diff --git a/test/sql-tap/triggerA.test.lua b/test/sql-tap/triggerA.test.lua
index 38a3dbea2..6a801bda2 100755
--- a/test/sql-tap/triggerA.test.lua
+++ b/test/sql-tap/triggerA.test.lua
@@ -36,7 +36,6 @@ test:do_test(
             CREATE TABLE t1(x INTEGER PRIMARY KEY, y TEXT UNIQUE);
             CREATE TABLE t2(a INTEGER PRIMARY KEY, b INTEGER UNIQUE, c TEXT);
         ]]
-        local i = 1
         local words = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"}
         for i, word in ipairs(words) do
         -- for _ in X(0, "X!foreach", [=[["word","one two three four five six seven eight nine ten"]]=]) do
diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua
index 7d496bc4d..273d21d39 100755
--- a/test/sql-tap/triggerC.test.lua
+++ b/test/sql-tap/triggerC.test.lua
@@ -16,7 +16,6 @@ test:plan(43)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "triggerC"
 
 
 ---------------------------------------------------------------------------
diff --git a/test/sql-tap/types.test.lua b/test/sql-tap/types.test.lua
index 91a89b887..dad88bdef 100755
--- a/test/sql-tap/types.test.lua
+++ b/test/sql-tap/types.test.lua
@@ -1,6 +1,5 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-local NULL = require('msgpack').NULL
 test:plan(14)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/where2.test.lua b/test/sql-tap/where2.test.lua
index 3b7e36093..19611a05f 100755
--- a/test/sql-tap/where2.test.lua
+++ b/test/sql-tap/where2.test.lua
@@ -1,8 +1,5 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-local yaml = require("yaml")
-local fio = require("fio")
-
 local ffi = require("ffi")
 test:plan(74)
 
@@ -60,16 +57,6 @@ test:do_test(
         -- </where2-1.0>
     })
 
--- Do an SQL statement.  Append the search count to the end of the result.
---
-local function count(sql)
-    local sql_sort_count = box.stat.sql().sql_sort_count
-    local r = test:execsql(sql)
-    print("lol "..(box.stat.sql().sql_sort_count - sql_sort_count))
-    table.insert(r, box.stat.sql().sql_sort_count - sql_sort_count)
-    return r
-end
-
 -- This procedure executes the SQL.  Then it checks to see if the OP_Sort
 -- opcode was executed.  If an OP_Sort did occur, then "sort" is appended
 -- to the result.  If no OP_Sort happened, then "nosort" is appended.
diff --git a/test/sql-tap/where4.test.lua b/test/sql-tap/where4.test.lua
index 65e7f9337..8eae3dc2c 100755
--- a/test/sql-tap/where4.test.lua
+++ b/test/sql-tap/where4.test.lua
@@ -23,8 +23,6 @@ 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"]]
-local testprefix = "where4"
-
 
 -- Build some test data
 --
diff --git a/test/sql-tap/whereC.test.lua b/test/sql-tap/whereC.test.lua
index 334d4cf29..145febd90 100755
--- a/test/sql-tap/whereC.test.lua
+++ b/test/sql-tap/whereC.test.lua
@@ -1,6 +1,5 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-local yaml = require('yaml')
 test:plan(41)
 
 --!./tcltestrunner.lua
@@ -17,7 +16,6 @@ test:plan(41)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-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 26221ec12..e0e9a3853 100755
--- a/test/sql-tap/whereD.test.lua
+++ b/test/sql-tap/whereD.test.lua
@@ -19,7 +19,6 @@ test:plan(36)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-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 12aefc4a4..73c87abc9 100755
--- a/test/sql-tap/whereF.test.lua
+++ b/test/sql-tap/whereF.test.lua
@@ -48,7 +48,6 @@ test:plan(13)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-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 2fbc6c5b3..2a76d2438 100755
--- a/test/sql-tap/whereG.test.lua
+++ b/test/sql-tap/whereG.test.lua
@@ -18,7 +18,6 @@ test:plan(23)
 -- likelihood() functions.
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-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 79c6bcfe5..43614b0eb 100755
--- a/test/sql-tap/whereI.test.lua
+++ b/test/sql-tap/whereI.test.lua
@@ -20,7 +20,6 @@ test:plan(7)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-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 0ca7fff0d..597a6f414 100755
--- a/test/sql-tap/whereK.test.lua
+++ b/test/sql-tap/whereK.test.lua
@@ -23,7 +23,6 @@ test:plan(10)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-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 86dd4f83a..89a427ecc 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -18,7 +18,6 @@ test:plan(64)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "with1"
 -- if X(0, "X!capable", [["!cte"]]) then
 --   test:finish_test()
 --  return 
diff --git a/test/sql-tap/with2.test.lua b/test/sql-tap/with2.test.lua
index 456ded363..c16efac4d 100755
--- a/test/sql-tap/with2.test.lua
+++ b/test/sql-tap/with2.test.lua
@@ -18,7 +18,6 @@ test:plan(59)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-local testprefix = "with2"
 
 test:do_execsql_test(
     1.0,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 05/14] test: fix luacheck warnings W212 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (3 preceding siblings ...)
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:50 ` Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 06/14] test: fix laucheck warnings W213 " Sergey Bronnikov via Tarantool-patches
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:50 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W212 (Unused argument)

Part of #5464
---
 .luacheckrc                                 | 2 --
 test/sql-tap/e_expr.test.lua                | 4 ++--
 test/sql-tap/identifier-characters.test.lua | 2 +-
 test/sql-tap/lua/sqltester.lua              | 2 +-
 test/sql-tap/sort.test.lua                  | 2 +-
 5 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 9098d7112..c986b1cc2 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,6 @@ exclude_files = {
 
 files["test/sql-tap/**/*.lua"] = {
     ignore = {
-        -- Unused argument.
-        "212",
         -- Unused loop variable.
         "213",
         -- Local variable is set but never accessed.
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index f29b26175..9947bbcd4 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
         local stmt = sql_prepare_v2("db", sql, -1)
         for _ in X(0, "X!foreach", [=[["number name",["params"]]]=]) do
             X(480, "X!cmd", [=[["do_test",[["tn"],".name.",["number"]],[["list","set","",["nm"]]],["name"]]]=])
@@ -1263,7 +1263,7 @@ test:do_execsql_test(
 test:execsql [[
     CREATE TABLE tblname(cname INT PRIMARY KEY);
 ]]
-local function glob(args)
+local function glob()
     return 1
 end
 
diff --git a/test/sql-tap/identifier-characters.test.lua b/test/sql-tap/identifier-characters.test.lua
index 7b257921d..184916bd3 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/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 53d3c2514..af1c2476e 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -176,7 +176,7 @@ local function execsql(self, sql)
 end
 test.execsql = execsql
 
-local function catchsql(self, sql, expect)
+local function catchsql(self, sql)
     local r = {pcall(execsql, self, sql) }
     if r[1] == true then
         r[1] = 0
diff --git a/test/sql-tap/sort.test.lua b/test/sql-tap/sort.test.lua
index a11522741..bf56d0ac9 100755
--- a/test/sql-tap/sort.test.lua
+++ b/test/sql-tap/sort.test.lua
@@ -760,7 +760,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"]]=])
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 06/14] test: fix laucheck warnings W213 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (4 preceding siblings ...)
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 05/14] test: fix luacheck warnings W212 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:50 ` Sergey Bronnikov via Tarantool-patches
  2021-01-24 17:35   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 07/14] test: fix luacheck warnings W231 " Sergey Bronnikov via Tarantool-patches
                   ` (9 subsequent siblings)
  15 siblings, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:50 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W213 (Unused loop variable)

Part of #5464
---
 .luacheckrc                                          |  2 --
 test/sql-tap/analyze9.test.lua                       |  2 +-
 test/sql-tap/between.test.lua                        |  2 +-
 test/sql-tap/e_expr.test.lua                         |  6 +++---
 test/sql-tap/gh-2723-concurrency.test.lua            |  8 ++++----
 test/sql-tap/gh-3083-ephemeral-unref-tuples.test.lua |  2 +-
 test/sql-tap/gh-3332-tuple-format-leak.test.lua      |  2 +-
 test/sql-tap/gh2127-indentifier-max-length.test.lua  | 10 +++++-----
 test/sql-tap/lua/sqltester.lua                       |  2 +-
 test/sql-tap/misc5.test.lua                          |  2 +-
 test/sql-tap/select1.test.lua                        |  2 +-
 test/sql-tap/selectB.test.lua                        |  4 ++--
 test/sql-tap/trigger2.test.lua                       |  4 ++--
 13 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index c986b1cc2..2e33cc05e 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,6 @@ exclude_files = {
 
 files["test/sql-tap/**/*.lua"] = {
     ignore = {
-        -- Unused loop variable.
-        "213",
         -- Local variable is set but never accessed.
         "231",
         -- "Value assigned to a local variable is unused."
diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 775b02587..794bda379 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -242,7 +242,7 @@ test:do_execsql_test(
 local function insert_filler_rows_n(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
diff --git a/test/sql-tap/between.test.lua b/test/sql-tap/between.test.lua
index 550976b86..755833736 100755
--- a/test/sql-tap/between.test.lua
+++ b/test/sql-tap/between.test.lua
@@ -61,7 +61,7 @@ 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]
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index 9947bbcd4..5f8b206d3 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -2120,7 +2120,7 @@ test:do_execsql_test(
 local likeargs = {}
 local function likefunc(...)
     local args = {...}
-    for i, v in ipairs(args) do
+    for _, v in ipairs(args) do
         table.insert(likeargs, v)
     end
     return 1
@@ -2353,7 +2353,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
@@ -2412,7 +2412,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
diff --git a/test/sql-tap/gh-2723-concurrency.test.lua b/test/sql-tap/gh-2723-concurrency.test.lua
index aa9be0130..d48760ac4 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 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
 			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 5e286ed0d..48c6268cf 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 i = 1, 100000 do -- luacheck: ignore unused i
             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 112689327..bab70b714 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 i=1,300 do -- luacheck: ignore unused i
 	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 i=1, 300 do -- luacheck: ignore unused i
 	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 i=1, 300 do -- luacheck: ignore unused i
 	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 i=1, 300 do -- luacheck: ignore unused i
 	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 i=1, 300 do -- luacheck: ignore unused i
 	table.insert(trig_table, trigger_word)
 end
 
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index af1c2476e..fbecb47ea 100644
--- 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
+    for i=1,8 do -- luacheck: ignore unused i
         table.remove(tr,1)
     end
     return tr
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 4bc18aa87..62678bbbd 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
+        for i = 0, 199, 1 do -- luacheck: ignore unused i
             sql = sql .. "(1+"
             tail = tail .. ")"
         end
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index 99bcce93b..d1301e5ad 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
+        for i = 0,9,1 do -- luacheck: ignore unused i
             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/selectB.test.lua b/test/sql-tap/selectB.test.lua
index b56403ce5..6c7bc805a 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(
diff --git a/test/sql-tap/trigger2.test.lua b/test/sql-tap/trigger2.test.lua
index 680cd07b8..4a4454597 100755
--- a/test/sql-tap/trigger2.test.lua
+++ b/test/sql-tap/trigger2.test.lua
@@ -127,12 +127,12 @@ for _, tbl_defn in ipairs(tbl_definitions) do
             local 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, {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 07/14] test: fix luacheck warnings W231 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (5 preceding siblings ...)
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 06/14] test: fix laucheck warnings W213 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:50 ` Sergey Bronnikov via Tarantool-patches
  2021-01-24 17:35   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 08/14] test: fix luacheck warnings W311 " Sergey Bronnikov via Tarantool-patches
                   ` (8 subsequent siblings)
  15 siblings, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:50 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W231 (Local variable is set but never accessed)

Part of #5464
---
 .luacheckrc                  |  2 --
 test/sql-tap/e_expr.test.lua | 19 -------------------
 2 files changed, 21 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 2e33cc05e..bfce2a6b4 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,6 @@ exclude_files = {
 
 files["test/sql-tap/**/*.lua"] = {
     ignore = {
-        -- Local variable is set but never accessed.
-        "231",
         -- "Value assigned to a local variable is unused."
         "311",
         -- Unreachable code.
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index 5f8b206d3..b488bdc60 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -2486,10 +2486,6 @@ test:do_execsql_test(
         -- </e_expr-20.2>
     })
 
-local a, b, c
-a = 0
-b = 0
-c = 0
 local varlist = {  }
 local function var(nm)
     table.insert(varlist,nm)
@@ -2554,9 +2550,6 @@ test:do_test(
 -- evaluation of the THEN expression that corresponds to the first WHEN
 -- expression that evaluates to true.
 --
-a = 0
-b = 1
-c = 0
 test:do_execsql_test(
     "e_expr-21.2.1",
     [[
@@ -2570,9 +2563,6 @@ test:do_execsql_test(
         "B"
         -- </e_expr-21.2.1>
     })
-a = 0
-b = 1
-c = 1
 test:do_execsql_test(
     "e_expr-21.2.2",
     [[
@@ -2586,9 +2576,6 @@ test:do_execsql_test(
         "B"
         -- </e_expr-21.2.2>
     })
-a = 0
-b = 0
-c = 1
 test:do_execsql_test(
     "e_expr-21.2.3",
     [[
@@ -2607,9 +2594,6 @@ test:do_execsql_test(
 -- evaluate to true, the result of evaluating the ELSE expression, if
 -- any.
 --
-a = 0
-b = 0
-c = 0
 test:do_execsql_test(
     "e_expr-21.3.1",
     [[
@@ -2846,9 +2830,6 @@ test:do_execsql_test(
 -- or short-circuit, evaluation.
 --
 varlist = {}
-a = "0"
-b = "1"
-c = "0"
 test:do_execsql_test(
     "e_expr-25.1.1",
     [[
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 08/14] test: fix luacheck warnings W311 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (6 preceding siblings ...)
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 07/14] test: fix luacheck warnings W231 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:50 ` Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 09/14] test: fix luacheck warnings W511 " Sergey Bronnikov via Tarantool-patches
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:50 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W311 (Value assigned to a local variable is unused)

Part of #5464
---
 .luacheckrc                    |  2 --
 test/sql-tap/analyze9.test.lua | 16 ++++++++--------
 test/sql-tap/select9.test.lua  |  3 +--
 test/sql-tap/triggerA.test.lua |  1 -
 test/sql-tap/where2.test.lua   |  2 +-
 5 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index bfce2a6b4..31f9528ad 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,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.
diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 794bda379..7a24d6752 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -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
@@ -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
@@ -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\""
@@ -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\""
@@ -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\""
@@ -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\""
@@ -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\""
@@ -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
diff --git a/test/sql-tap/select9.test.lua b/test/sql-tap/select9.test.lua
index 045d0e4c8..769f70069 100755
--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -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(
diff --git a/test/sql-tap/triggerA.test.lua b/test/sql-tap/triggerA.test.lua
index 6a801bda2..f0e11d627 100755
--- a/test/sql-tap/triggerA.test.lua
+++ b/test/sql-tap/triggerA.test.lua
@@ -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;
diff --git a/test/sql-tap/where2.test.lua b/test/sql-tap/where2.test.lua
index 19611a05f..db7edd539 100755
--- a/test/sql-tap/where2.test.lua
+++ b/test/sql-tap/where2.test.lua
@@ -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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 09/14] test: fix luacheck warnings W511 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (7 preceding siblings ...)
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 08/14] test: fix luacheck warnings W311 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:50 ` Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 10/14] test: fix luacheck warnings W512 " Sergey Bronnikov via Tarantool-patches
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:50 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W511 (Unreachable code)

Part of #5464
---
 .luacheckrc                          | 2 --
 test/sql-tap/date.test.lua           | 3 ++-
 test/sql-tap/select1.test.lua        | 3 ++-
 test/sql-tap/table.test.lua          | 3 ++-
 test/sql-tap/tkt-bd484a090c.test.lua | 3 ++-
 test/sql-tap/tkt2192.test.lua        | 3 ++-
 6 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 31f9528ad..88fc34fa4 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,6 @@ exclude_files = {
 
 files["test/sql-tap/**/*.lua"] = {
     ignore = {
-        -- Unreachable code.
-        "511",
         -- Loop can be executed at most once.
         "512",
         -- An empty if branch.
diff --git a/test/sql-tap/date.test.lua b/test/sql-tap/date.test.lua
index fe5150719..0b37d52f8 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 is_gh_3694_closed = false
+if is_gh_3694_closed then
 local function datetest(tnum, expr, result)
     test:do_test(
         "date-"..tnum,
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index d1301e5ad..2f61ae0ec 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1513,7 +1513,8 @@ 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
+local is_gh_5737_closed = false
+if is_gh_5737_closed
  then
     test:do_execsql_test(
         "select1-8.4",
diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua
index 2817e1e72..bb36d994e 100755
--- a/test/sql-tap/table.test.lua
+++ b/test/sql-tap/table.test.lua
@@ -945,7 +945,8 @@ test:do_execsql_test(
 --
 --  Disabled until #3694 is resolved.
 --
-if false then
+local is_gh_3694_closed = false
+if is_gh_3694_closed then
 test:do_execsql_test(
     "table-13.1",
     [[
diff --git a/test/sql-tap/tkt-bd484a090c.test.lua b/test/sql-tap/tkt-bd484a090c.test.lua
index 6187fee7f..6cd219722 100755
--- a/test/sql-tap/tkt-bd484a090c.test.lua
+++ b/test/sql-tap/tkt-bd484a090c.test.lua
@@ -21,7 +21,8 @@ test:plan(0)
 
 -- Disabled until #3694 is resolved.
 --
-if false then
+local is_gh_3694_closed = false
+if is_gh_3694_closed then
 test:do_test(
     1.1,
     function()
diff --git a/test/sql-tap/tkt2192.test.lua b/test/sql-tap/tkt2192.test.lua
index dabdfd141..74ec19a63 100755
--- a/test/sql-tap/tkt2192.test.lua
+++ b/test/sql-tap/tkt2192.test.lua
@@ -26,7 +26,8 @@ test:plan(4)
 
 --  Disabled until #3694 is resolved.
 --
-if false then
+local is_gh_3694_closed = false
+if is_gh_3694_closed then
 test:do_execsql_test(
     "tkt2192-1.1",
     [[
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 10/14] test: fix luacheck warnings W512 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (8 preceding siblings ...)
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 09/14] test: fix luacheck warnings W511 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:50 ` Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 11/14] test: fix luacheck warnings W542 " Sergey Bronnikov via Tarantool-patches
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:50 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W512 (Loop can be executed at most once)

Part of #5464
---
 .luacheckrc                  | 2 --
 test/sql-tap/e_expr.test.lua | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 88fc34fa4..53c5de34d 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,6 @@ exclude_files = {
 
 files["test/sql-tap/**/*.lua"] = {
     ignore = {
-        -- Loop can be executed at most once.
-        "512",
         -- An empty if branch.
         "542",
         -- A line consists of nothing but whitespace.
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index b488bdc60..1260b321c 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -2660,6 +2660,7 @@ if 0>0 then
     -- comparisons take place.
     --
 
+    -- luacheck: ignore
     for _ in X(0, "X!foreach", [=[["a b c",[["list",[["expr","3"]],[["expr","4"]],[["expr","5"]]]]]]=]) do
         break
     end
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 11/14] test: fix luacheck warnings W542 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (9 preceding siblings ...)
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 10/14] test: fix luacheck warnings W512 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:50 ` Sergey Bronnikov via Tarantool-patches
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 12/14] test: fix luacheck warnings W612, W613, W614 " Sergey Bronnikov via Tarantool-patches
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:50 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W542 (An empty if branch)

Part of #5464
---
 .luacheckrc                          | 2 --
 test/sql-tap/selectA.test.lua        | 8 --------
 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(+), 19 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 53c5de34d..98e7cb9bb 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,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 db4d03985..af38b5007 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",
     [[
@@ -2353,11 +2350,6 @@ test:do_execsql_test(
 -- At one point the following code exposed a temp register reuse problem.
 --
 -- MUST_WORK_TEST
--- TODO stored procedures are not supported by now
-if (0 > 0)
- then
-end
-
 -- TODO stored procedures are not supported by now
 --db("func", "f", "f")
 test:do_execsql_test(
diff --git a/test/sql-tap/selectB.test.lua b/test/sql-tap/selectB.test.lua
index 6c7bc805a..f1f43af76 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 a72b8d957..dac546f10 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 3fbc1ce37..1e5246353 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 78e465b00..9387c5207 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 89a427ecc..32e187186 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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 12/14] test: fix luacheck warnings W612, W613, W614 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (10 preceding siblings ...)
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 11/14] test: fix luacheck warnings W542 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:50 ` Sergey Bronnikov via Tarantool-patches
  2021-01-24 17:36   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 13/14] test: fix luacheck warnings W621 " Sergey Bronnikov via Tarantool-patches
                   ` (3 subsequent siblings)
  15 siblings, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:50 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W612 (A line contains trailing whitespace)
W613 (Trailing whitespace in a string)
W614 (Trailing whitespace in a comment)

Note: changes were made automatically in vim with regexp "%s/\s\+$//e".

Part of #5464
---
 .luacheckrc                          |   6 --
 test/sql-tap/aggnested.test.lua      |   8 +--
 test/sql-tap/alias.test.lua          |   4 +-
 test/sql-tap/alter.test.lua          |   2 +-
 test/sql-tap/analyze1.test.lua       |   4 +-
 test/sql-tap/analyze3.test.lua       |  52 +++++++-------
 test/sql-tap/analyze4.test.lua       |   6 +-
 test/sql-tap/analyze5.test.lua       |   6 +-
 test/sql-tap/analyze8.test.lua       |   8 +--
 test/sql-tap/analyze9.test.lua       | 100 +++++++++++++--------------
 test/sql-tap/analyzeD.test.lua       |  16 ++---
 test/sql-tap/analyzeF.test.lua       |   2 +-
 test/sql-tap/atof1.test.lua          |   2 +-
 test/sql-tap/autoinc.test.lua        |   2 +-
 test/sql-tap/autoindex4.test.lua     |   6 +-
 test/sql-tap/colname.test.lua        |   6 +-
 test/sql-tap/contrib01.test.lua      |   4 +-
 test/sql-tap/date.test.lua           |   4 +-
 test/sql-tap/default.test.lua        |  12 ++--
 test/sql-tap/delete3.test.lua        |   2 +-
 test/sql-tap/delete4.test.lua        |  14 ++--
 test/sql-tap/distinct.test.lua       |   6 +-
 test/sql-tap/e_delete.test.lua       |   2 +-
 test/sql-tap/e_expr.test.lua         |  12 ++--
 test/sql-tap/e_select1.test.lua      |   4 +-
 test/sql-tap/eqp.test.lua            |  50 +++++++-------
 test/sql-tap/func5.test.lua          |   2 +-
 test/sql-tap/icu.test.lua            |   8 +--
 test/sql-tap/in1.test.lua            |  48 ++++++-------
 test/sql-tap/in2.test.lua            |  12 ++--
 test/sql-tap/in3.test.lua            |  34 ++++-----
 test/sql-tap/in4.test.lua            |  56 +++++++--------
 test/sql-tap/index3.test.lua         |   6 +-
 test/sql-tap/index4.test.lua         |  14 ++--
 test/sql-tap/insert1.test.lua        |   8 +--
 test/sql-tap/insert3.test.lua        |   2 +-
 test/sql-tap/join.test.lua           |  25 +++----
 test/sql-tap/join3.test.lua          |   4 +-
 test/sql-tap/join6.test.lua          |   2 +-
 test/sql-tap/keyword1.test.lua       |   2 +-
 test/sql-tap/limit.test.lua          |  24 +++----
 test/sql-tap/minmax3.test.lua        |  32 ++++-----
 test/sql-tap/minmax4.test.lua        |   4 +-
 test/sql-tap/misc1.test.lua          |   8 +--
 test/sql-tap/misc5.test.lua          |  52 +++++++-------
 test/sql-tap/null.test.lua           |  10 +--
 test/sql-tap/offset1.test.lua        |   8 +--
 test/sql-tap/orderby1.test.lua       |  10 +--
 test/sql-tap/orderby6.test.lua       |  34 ++++-----
 test/sql-tap/orderby9.test.lua       |   4 +-
 test/sql-tap/resolver01.test.lua     |   8 +--
 test/sql-tap/select1.test.lua        |  50 +++++++-------
 test/sql-tap/select3.test.lua        |  30 ++++----
 test/sql-tap/select4.test.lua        |  30 ++++----
 test/sql-tap/select5.test.lua        |   6 +-
 test/sql-tap/select6.test.lua        |  32 ++++-----
 test/sql-tap/select7.test.lua        |   8 +--
 test/sql-tap/select8.test.lua        |  24 +++----
 test/sql-tap/select9.test.lua        |  28 ++++----
 test/sql-tap/selectB.test.lua        |  72 +++++++++----------
 test/sql-tap/selectC.test.lua        |   6 +-
 test/sql-tap/selectE.test.lua        |  16 ++---
 test/sql-tap/selectF.test.lua        |   8 +--
 test/sql-tap/subquery.test.lua       |  30 ++++----
 test/sql-tap/subquery2.test.lua      |   8 +--
 test/sql-tap/subselect.test.lua      |   4 +-
 test/sql-tap/table.test.lua          |  42 +++++------
 test/sql-tap/tkt-02a8e81d44.test.lua |   2 +-
 test/sql-tap/tkt-31338dca7e.test.lua |   2 +-
 test/sql-tap/tkt-385a5b56b9.test.lua |   4 +-
 test/sql-tap/tkt-3a77c9714e.test.lua |   6 +-
 test/sql-tap/tkt-4a03edc4c8.test.lua |   2 +-
 test/sql-tap/tkt-4dd95f6943.test.lua |  16 ++---
 test/sql-tap/tkt-54844eea3f.test.lua |   6 +-
 test/sql-tap/tkt-752e1646fc.test.lua |   8 +--
 test/sql-tap/tkt-7bbfb7d442.test.lua |  14 ++--
 test/sql-tap/tkt-80ba201079.test.lua |   4 +-
 test/sql-tap/tkt-8c63ff0ec.test.lua  |   4 +-
 test/sql-tap/tkt-91e2e8ba6f.test.lua |   6 +-
 test/sql-tap/tkt-a8a0d2996a.test.lua |   2 +-
 test/sql-tap/tkt-ba7cbfaedc.test.lua |   4 +-
 test/sql-tap/tkt-bd484a090c.test.lua |   2 +-
 test/sql-tap/tkt-f973c7ac31.test.lua |   6 +-
 test/sql-tap/tkt-fa7bf5ec.test.lua   |   6 +-
 test/sql-tap/tkt1443.test.lua        |   6 +-
 test/sql-tap/tkt1444.test.lua        |   2 +-
 test/sql-tap/tkt1449.test.lua        |   2 +-
 test/sql-tap/tkt1473.test.lua        |   8 +--
 test/sql-tap/tkt1501.test.lua        |   2 +-
 test/sql-tap/tkt1514.test.lua        |   2 +-
 test/sql-tap/tkt1537.test.lua        |   2 +-
 test/sql-tap/tkt2141.test.lua        |   2 +-
 test/sql-tap/tkt2192.test.lua        |   4 +-
 test/sql-tap/tkt2391.test.lua        |   4 +-
 test/sql-tap/tkt2640.test.lua        |   2 +-
 test/sql-tap/tkt2822.test.lua        |  46 ++++++------
 test/sql-tap/tkt2927.test.lua        |  64 ++++++++---------
 test/sql-tap/tkt2942.test.lua        |   2 +-
 test/sql-tap/tkt3201.test.lua        |   6 +-
 test/sql-tap/tkt3298.test.lua        |   2 +-
 test/sql-tap/tkt3357.test.lua        |   8 +--
 test/sql-tap/tkt3424.test.lua        |  10 +--
 test/sql-tap/tkt3442.test.lua        |   4 +-
 test/sql-tap/tkt3493.test.lua        |  68 +++++++++---------
 test/sql-tap/tkt3554.test.lua        |   2 +-
 test/sql-tap/tkt3581.test.lua        |   4 +-
 test/sql-tap/tkt3935.test.lua        |  17 +++--
 test/sql-tap/tokenize.test.lua       |   2 +-
 test/sql-tap/transitive1.test.lua    |   4 +-
 test/sql-tap/triggerB.test.lua       |  10 +--
 test/sql-tap/types2.test.lua         |   8 +--
 test/sql-tap/update.test.lua         |  28 ++++----
 test/sql-tap/view.test.lua           |   8 +--
 test/sql-tap/where2.test.lua         |  34 ++++-----
 test/sql-tap/where3.test.lua         |  50 +++++++-------
 test/sql-tap/where4.test.lua         |  16 ++---
 test/sql-tap/where6.test.lua         |   6 +-
 test/sql-tap/where7.test.lua         |  10 +--
 test/sql-tap/whereD.test.lua         |   6 +-
 test/sql-tap/whereF.test.lua         |   8 +--
 test/sql-tap/whereG.test.lua         |   8 +--
 test/sql-tap/whereI.test.lua         |   6 +-
 test/sql-tap/with1.test.lua          |  54 +++++++--------
 test/sql-tap/with2.test.lua          |  40 +++++------
 124 files changed, 907 insertions(+), 905 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 98e7cb9bb..69be93a67 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -53,12 +53,6 @@ files["test/sql-tap/**/*.lua"] = {
     ignore = {
         -- A line consists of nothing but whitespace.
         "611",
-        -- A line contains trailing whitespace.
-        "612",
-        -- Trailing whitespace in a string.
-        "613",
-        -- Trailing whitespace in a comment.
-        "614",
         -- Inconsistent indentation (SPACE followed by TAB).
         "621",
         -- Line is too long.
diff --git a/test/sql-tap/aggnested.test.lua b/test/sql-tap/aggnested.test.lua
index 37471f48a..6a967461d 100755
--- a/test/sql-tap/aggnested.test.lua
+++ b/test/sql-tap/aggnested.test.lua
@@ -15,7 +15,7 @@ test:plan(7)
 -------------------------------------------------------------------------
 -- This file implements regression tests for sql library.
 --
--- This file implements tests for processing aggregate queries with 
+-- This file implements tests for processing aggregate queries with
 -- subqueries in which the subqueries hold the aggregate functions
 -- or in which the subqueries are themselves aggregate queries
 --
@@ -74,17 +74,17 @@ test:do_execsql_test("aggnested-1.4",
 -- #
 -- do_test aggnested-2.0 {
 --   db2 eval {
---     CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT 
+--     CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT
 --     NULL,A4 INTEGER NOT NULL,PRIMARY KEY(A1));
 --     REPLACE INTO t1 VALUES(1,11,111,1111);
 --     REPLACE INTO t1 VALUES(2,22,222,2222);
 --     REPLACE INTO t1 VALUES(3,33,333,3333);
---     CREATE TABLE t2 (B1 INTEGER NOT NULL,B2 INTEGER NOT NULL,B3 INTEGER NOT 
+--     CREATE TABLE t2 (B1 INTEGER NOT NULL,B2 INTEGER NOT NULL,B3 INTEGER NOT
 --     NULL,B4 INTEGER NOT NULL,PRIMARY KEY(B1));
 --     REPLACE INTO t2 VALUES(1,88,888,8888);
 --     REPLACE INTO t2 VALUES(2,99,999,9999);
 --     SELECT (SELECT GROUP_CONCAT(CASE WHEN a1=1 THEN'A' ELSE 'B' END) FROM t2),
---             t1.* 
+--             t1.*
 --     FROM t1;
 --   }
 -- } {A,B,B 3 33 333 3333}
diff --git a/test/sql-tap/alias.test.lua b/test/sql-tap/alias.test.lua
index 27a611d19..40078dcee 100755
--- a/test/sql-tap/alias.test.lua
+++ b/test/sql-tap/alias.test.lua
@@ -95,8 +95,8 @@ test:do_test(
 --     function()
 --         counter = 0
 --         return test:execsql([[
---             SELECT x, sequence() AS y FROM t1 
---              WHERE y>0 AND y<99 AND y!=55 AND y NOT IN (56,57,58) 
+--             SELECT x, sequence() AS y FROM t1
+--              WHERE y>0 AND y<99 AND y!=55 AND y NOT IN (56,57,58)
 --                AND y NOT LIKE 'abc%' AND y%10==2 order by x desc
 --         ]])
 --     end, {
diff --git a/test/sql-tap/alter.test.lua b/test/sql-tap/alter.test.lua
index 2fece6649..9ed09b41c 100755
--- a/test/sql-tap/alter.test.lua
+++ b/test/sql-tap/alter.test.lua
@@ -49,7 +49,7 @@ test:do_execsql_test(
     [[
         SELECT 't1', * FROM "t1";
         SELECT 't2', * FROM t2;
-        SELECT 'space_table', * FROM SPACE_TABLE;  
+        SELECT 'space_table', * FROM SPACE_TABLE;
     ]], {
         -- <alter-1.4>
         "space_table", 1, 5, 6, 7
diff --git a/test/sql-tap/analyze1.test.lua b/test/sql-tap/analyze1.test.lua
index 18770a086..3a2539a5d 100755
--- a/test/sql-tap/analyze1.test.lua
+++ b/test/sql-tap/analyze1.test.lua
@@ -252,7 +252,7 @@ test:do_execsql_test(
         DROP TABLE t2;
         SELECT "idx", "stat" FROM "_sql_stat1" ORDER BY "idx";
     ]], {
-        -- <analyze-3.8>      
+        -- <analyze-3.8>
         -- </analyze-3.8>
     })
 
@@ -348,7 +348,7 @@ test:do_execsql_test(
 
 
 
--- Verify that DROP TABLE and DROP INDEX remove entries from the 
+-- Verify that DROP TABLE and DROP INDEX remove entries from the
 -- sql_stat1, sql_stat3 and sql_stat4 tables.
 --
 test:do_execsql_test(
diff --git a/test/sql-tap/analyze3.test.lua b/test/sql-tap/analyze3.test.lua
index 5f0b24fea..a7b6ba2f6 100755
--- a/test/sql-tap/analyze3.test.lua
+++ b/test/sql-tap/analyze3.test.lua
@@ -21,15 +21,15 @@ test:plan(37)
 ------------------------------------------------------------------------
 -- Test Organization:
 --
--- analyze3-1.*: Test that the values of bound parameters are considered 
+-- analyze3-1.*: Test that the values of bound parameters are considered
 --               in the same way as constants when planning queries that
 --               use range constraints.
 --
--- analyze3-2.*: Test that the values of bound parameters are considered 
+-- analyze3-2.*: Test that the values of bound parameters are considered
 --               in the same way as constants when planning queries that
 --               use LIKE expressions in the WHERE clause.
 --
--- analyze3-3.*: Test that binding to a variable does not invalidate the 
+-- analyze3-3.*: Test that binding to a variable does not invalidate the
 --               query plan when there is no way in which replanning the
 --               query may produce a superior outcome.
 --
@@ -39,23 +39,23 @@ test:plan(37)
 -- analyze3-5.*: Check that the query plans of applicable statements are
 --               invalidated if the values of SQL parameter are modified
 --               using the clear_bindings() or transfer_bindings() APIs.
--- 
+--
 -- analyze3-6.*: Test that the problem fixed by commit [127a5b776d] is fixed.
 --
--- analyze3-7.*: Test that some memory leaks discovered by fuzz testing 
+-- analyze3-7.*: Test that some memory leaks discovered by fuzz testing
 --               have been fixed.
 --
 
 ---------------------------------------------------------------------------
 --
--- analyze3-1.1.1: 
---   Create a table with two columns. Populate the first column (affinity 
---   INTEGER) with integer values from 100 to 1100. Create an index on this 
+-- analyze3-1.1.1:
+--   Create a table with two columns. Populate the first column (affinity
+--   INTEGER) with integer values from 100 to 1100. Create an index on this
 --   column. ANALYZE the table.
 --
 -- analyze3-1.1.2 - 3.1.3
 --   Show that there are two possible plans for querying the table with
---   a range constraint on the indexed column - "full table scan" or "use 
+--   a range constraint on the indexed column - "full table scan" or "use
 --   the index". When the range is specified using literal values, sql
 --   is able to pick the best plan based on the samples in sql_stat3.
 --
@@ -63,8 +63,8 @@ test:plan(37)
 --   Show that using SQL variables produces the same results as using
 --   literal values to constrain the range scan.
 --
---   These tests also check that the compiler code considers column 
---   affinities when estimating the number of rows scanned by the "use 
+--   These tests also check that the compiler code considers column
+--   affinities when estimating the number of rows scanned by the "use
 --   index strategy".
 --
 test:do_test(
@@ -112,7 +112,7 @@ test:do_execsql_test(
     })
 
 -- The first of the following two SELECT statements visits 99 rows. So
--- it is better to use the index. But the second visits every row in 
+-- it is better to use the index. But the second visits every row in
 -- the table (1000 in total) so it is better to do a full-table scan.
 --
 test:do_eqp_test(
@@ -128,7 +128,7 @@ test:do_eqp_test(
 test:do_eqp_test(
     "analyze3-1.1.3",
     [[
-        SELECT sum(y) FROM t1 WHERE x>0 AND x<1100 
+        SELECT sum(y) FROM t1 WHERE x>0 AND x<1100
     ]], {
         -- Tarantool: index is always covering, thus there is no need to scan table.
         -- <analyze3-1.1.3>
@@ -140,7 +140,7 @@ test:do_eqp_test(
 test:do_sf_execsql_test(
     "analyze3-1.1.4",
     [[
-        SELECT sum(y) FROM t1 WHERE x>200 AND x<300 
+        SELECT sum(y) FROM t1 WHERE x>200 AND x<300
     ]], {
         -- <analyze3-1.1.4>
         -- 199, 0, 14850
@@ -173,7 +173,7 @@ test:do_test(
 test:do_sf_execsql_test(
     "analyze3-1.1.7",
     [[
-        SELECT sum(y) FROM t1 WHERE x>0 AND x<1100 
+        SELECT sum(y) FROM t1 WHERE x>0 AND x<1100
     ]], {
         -- <analyze3-1.1.7>
         1000, {499500}
@@ -215,7 +215,7 @@ test:do_execsql_test(
         ANALYZE;
     ]], {
         -- <analyze3-1.2.1>
-        
+
         -- </analyze3-1.2.1>
     })
 
@@ -267,7 +267,7 @@ test:do_eqp_test(
  test:do_sf_execsql_test(
     "analyze3-1.2.4",
     [[
-        SELECT sum(y) FROM t2 WHERE x>12 AND x<20 
+        SELECT sum(y) FROM t2 WHERE x>12 AND x<20
     ]], {
         -- <analyze3-1.2.4>
         999, {""}
@@ -297,7 +297,7 @@ test:do_test(
 test:do_sf_execsql_test(
     "analyze3-1.2.7",
     [[
-        SELECT sum(y) FROM t2 WHERE x>0 AND x<99 
+        SELECT sum(y) FROM t2 WHERE x>0 AND x<99
     ]], {
         -- <analyze3-1.2.7>
         999, {""}
@@ -339,7 +339,7 @@ test:do_execsql_test(
         ANALYZE;
     ]], {
         -- <analyze3-1.3.1>
-        
+
         -- </analyze3-1.3.1>
     })
 
@@ -389,7 +389,7 @@ test:do_eqp_test(
 test:do_sf_execsql_test(
     "analyze3-1.3.4",
     [[
-        SELECT sum(y) FROM t3 WHERE x>200 AND x<300 
+        SELECT sum(y) FROM t3 WHERE x>200 AND x<300
     ]], {
         -- <analyze3-1.3.4>
         100, {14850}
@@ -419,7 +419,7 @@ test:do_test(
 test:do_sf_execsql_test(
     "analyze3-1.3.7",
     [[
-        SELECT sum(y) FROM t3 WHERE x>0 AND x<1100 
+        SELECT sum(y) FROM t3 WHERE x>0 AND x<1100
     ]], {
         -- <analyze3-1.3.7>
         1000, {499500}
@@ -471,7 +471,7 @@ test:do_test(
 --         return test:execsql("COMMIT")
 --     end, {
 --         -- <analyze3-2.1>
-        
+
 --         -- </analyze3-2.1>
 --     })
 
@@ -498,7 +498,7 @@ test:do_test(
 -- test:do_sf_execsql_test(
 --     "analyze3-2.4",
 --     [[
---         SELECT count(*) FROM t1 WHERE b LIKE 'a%' 
+--         SELECT count(*) FROM t1 WHERE b LIKE 'a%'
 --     ]], {
 --         -- <analyze3-2.4>
 --         102, 0, 100
@@ -508,7 +508,7 @@ test:do_test(
 -- test:do_sf_execsql_test(
 --     "analyze3-2.5",
 --     [[
---         SELECT count(*) FROM t1 WHERE b LIKE '%a' 
+--         SELECT count(*) FROM t1 WHERE b LIKE '%a'
 --     ]], {
 --         -- <analyze3-2.5>
 --         999, 999, 100
@@ -601,7 +601,7 @@ test:do_test(
         return test:execsql("ANALYZE")
     end, {
         -- <analyze3-6.1>
-        
+
         -- </analyze3-6.1>
     })
 
@@ -640,7 +640,7 @@ test:do_execsql_test(
         SELECT c FROM t1 WHERE b=3 AND a BETWEEN 30 AND hex(1);
     ]], {
         -- <analyze-7.1>
-        
+
         -- </analyze-7.1>
     })
 
diff --git a/test/sql-tap/analyze4.test.lua b/test/sql-tap/analyze4.test.lua
index 8327b78c7..0970b3882 100755
--- a/test/sql-tap/analyze4.test.lua
+++ b/test/sql-tap/analyze4.test.lua
@@ -16,7 +16,7 @@ test:plan(4)
 --
 -- This file implements regression tests for sql library. This file
 -- implements tests for ANALYZE to verify that multiple rows containing
--- a NULL value count as distinct rows for the purposes of analyze 
+-- a NULL value count as distinct rows for the purposes of analyze
 -- statistics.
 --
 -- Also include test cases for collating sequences on indices.
@@ -62,7 +62,7 @@ test:do_execsql_test(
     })
 
 -- Change half of the b values from NULL to a constant.  Verify
--- that the number of rows selected in stat1 is half the total 
+-- that the number of rows selected in stat1 is half the total
 -- number of rows.
 --
 test:do_test(
@@ -82,7 +82,7 @@ test:do_test(
     })
 
 -- Change the t1.b values all back to NULL.  Add columns t1.c and t1.d.
--- Create a multi-column indices using t1.b and verify that ANALYZE 
+-- Create a multi-column indices using t1.b and verify that ANALYZE
 -- processes them correctly.
 --
 test:do_execsql_test(
diff --git a/test/sql-tap/analyze5.test.lua b/test/sql-tap/analyze5.test.lua
index d53648919..91af12529 100755
--- a/test/sql-tap/analyze5.test.lua
+++ b/test/sql-tap/analyze5.test.lua
@@ -65,7 +65,7 @@ test:do_test(
             if  i >= 875 then
                 z = z + 1
             end
-            
+
             local x, w, t, u
             x = z
             w = z
@@ -116,7 +116,7 @@ test:do_test(
 --     "analyze5-1.1",
 --     function()
 --         return test:execsql([[
---             SELECT DISTINCT lower(lindex(test_decode(sample), 0)) 
+--             SELECT DISTINCT lower(lindex(test_decode(sample), 0))
 --               FROM _sql_stat4 WHERE idx='t1v' ORDER BY 1
 --         ]])
 
@@ -222,7 +222,7 @@ for i, v in pairs({
 {'y=1',                t1y,   26},
 {'y=0.1',              t1y,    1},
 
-{'x IS NULL',          t1x,  400},        
+{'x IS NULL',          t1x,  400},
                  }) do
     -- Verify that the expected index is used with the expected row count
     -- No longer valid due to an EXPLAIN QUERY PLAN output format change
diff --git a/test/sql-tap/analyze8.test.lua b/test/sql-tap/analyze8.test.lua
index cf40ce7bb..76f9c57cb 100755
--- a/test/sql-tap/analyze8.test.lua
+++ b/test/sql-tap/analyze8.test.lua
@@ -51,7 +51,7 @@ test:do_test(
         end
         return test:execsql("ANALYZE")
     end, {
-        -- <1.0>        
+        -- <1.0>
         -- </1.0>
     })
 
@@ -60,7 +60,7 @@ test:do_test(
 
 -- But for a==99 and a==101, there are far fewer rows so choose
 -- the t1a index.
-    
+
 test:do_eqp_test(
     1.1,
     [[SELECT * FROM t1 WHERE a=100 AND b=55]],
@@ -127,12 +127,12 @@ test:do_eqp_test(
 -- There are many more values of c between 0 and 100000 than there are
 -- between 800000 and 900000.  So t1c is more selective for the latter
 -- range.
--- 
+--
 -- Test 3.2 is a little unstable. It depends on the planner estimating
 -- that (b BETWEEN 30 AND 34) will match more rows than (c BETWEEN
 -- 800000 AND 900000). Which is a pretty close call (50 vs. 32), so
 -- the planner could get it wrong with an unlucky set of samples. This
--- case happens to work, but others ("b BETWEEN 40 AND 44" for example) 
+-- case happens to work, but others ("b BETWEEN 40 AND 44" for example)
 -- will fail.
 --
 test:do_execsql_test(
diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 7a24d6752..06e6ae070 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -23,7 +23,7 @@ test:do_execsql_test(
     1.0,
     [[
         DROP TABLE IF EXISTS t1;
-        CREATE TABLE t1(a TEXT PRIMARY KEY, b TEXT); 
+        CREATE TABLE t1(a TEXT PRIMARY KEY, b TEXT);
         INSERT INTO t1 VALUES('(0)', '(0)');
         INSERT INTO t1 VALUES('(1)', '(1)');
         INSERT INTO t1 VALUES('(2)', '(2)');
@@ -51,7 +51,7 @@ local function msgpack_decode_sample(txt)
     while msgpack.decode(txt)[i] ~= nil do
         if i == 1 then
             decoded_str = msgpack.decode(txt)[i]
-        else 
+        else
             decoded_str = decoded_str.." "..msgpack.decode(txt)[i]
         end
         i = i+1
@@ -71,8 +71,8 @@ test:do_execsql_test(
         SELECT "tbl","idx","neq","nlt","ndlt",msgpack_decode_sample("sample") FROM "_sql_stat4" where "idx" = 'I1';
     ]], {
         -- <1.2>
-        "T1", "I1", "1 1", "0 0", "0 0", "(0) (0)", "T1", "I1", "1 1", "1 1", "1 1", "(1) (1)", 
-        "T1", "I1", "1 1", "2 2", "2 2", "(2) (2)", "T1", "I1", "1 1", "3 3", "3 3", "(3) (3)", 
+        "T1", "I1", "1 1", "0 0", "0 0", "(0) (0)", "T1", "I1", "1 1", "1 1", "1 1", "(1) (1)",
+        "T1", "I1", "1 1", "2 2", "2 2", "(2) (2)", "T1", "I1", "1 1", "3 3", "3 3", "(3) (3)",
         "T1", "I1", "1 1", "4 4", "4 4", "(4) (4)"
         -- </1.2>
     })
@@ -84,8 +84,8 @@ test:do_execsql_test(
 
     ]], {
         -- <1.3>
-        'T1', 'T1', '1', '0', '0', '(0)', 'T1', 'T1', '1', '1', '1', '(1)', 
-        'T1', 'T1', '1', '2', '2', '(2)', 'T1', 'T1', '1', '3', '3', '(3)', 
+        'T1', 'T1', '1', '0', '0', '(0)', 'T1', 'T1', '1', '1', '1', '(1)',
+        'T1', 'T1', '1', '2', '2', '(2)', 'T1', 'T1', '1', '3', '3', '(3)',
         'T1', 'T1', '1', '4', '4', '(4)'
         -- </1.3>
     })
@@ -148,7 +148,7 @@ local function lrange(str, first, last)
         if i >= first and i <= last then
             if i == first then
                 res_tokens = token
-            else 
+            else
                 res_tokens = res_tokens.." "..token
             end
         end
@@ -187,7 +187,7 @@ test:do_execsql_test(
     ]], generate_tens(100))
 
 -- The first element in the "nEq" list of all samples should therefore be 10.
---      
+--
 test:do_execsql_test(
     "3.3.2",
     [[
@@ -196,7 +196,7 @@ test:do_execsql_test(
     ]], generate_tens_str(24))
 
 ---------------------------------------------------------------------------
--- 
+--
 test:do_execsql_test(
     3.4,
     [[
@@ -227,7 +227,7 @@ test:do_execsql_test(
     })
 
 ---------------------------------------------------------------------------
--- These tests verify that the sample selection for stat4 appears to be 
+-- These tests verify that the sample selection for stat4 appears to be
 -- working as designed.
 --
 test:do_execsql_test(
@@ -290,7 +290,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     4.3,
     [[
-        SELECT "neq", lrange("nlt", 1, 3), lrange("ndlt", 1, 3), lrange(msgpack_decode_sample("sample"), 1, 3) 
+        SELECT "neq", lrange("nlt", 1, 3), lrange("ndlt", 1, 3), lrange(msgpack_decode_sample("sample"), 1, 3)
             FROM "_sql_stat4" WHERE "idx" = 'I1' ORDER BY "sample" LIMIT 16;
     ]], {
         -- <4.3>
@@ -307,7 +307,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     4.4,
     [[
-        SELECT "neq", lrange("nlt", 1, 3), lrange("ndlt", 1, 3), lrange(msgpack_decode_sample("sample"), 1, 3) 
+        SELECT "neq", lrange("nlt", 1, 3), lrange("ndlt", 1, 3), lrange(msgpack_decode_sample("sample"), 1, 3)
         FROM "_sql_stat4" WHERE "idx" = 'I1' ORDER BY "sample" DESC LIMIT 2;
     ]], {
         -- <4.4>
@@ -318,7 +318,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     4.5,
     [[
-        SELECT count(DISTINCT c) FROM t1 WHERE c<201 
+        SELECT count(DISTINCT c) FROM t1 WHERE c<201
     ]], {
         -- <4.5>
         120
@@ -328,7 +328,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     4.6,
     [[
-        SELECT count(DISTINCT c) FROM t1 WHERE c<200 
+        SELECT count(DISTINCT c) FROM t1 WHERE c<200
     ]], {
         -- <4.6>
         119
@@ -625,7 +625,7 @@ test:do_test(
     end
         return test:execsql("ANALYZE")
     end, {
-        -- <10.1.2>      
+        -- <10.1.2>
         -- </10.1.2>
     })
 
@@ -673,7 +673,7 @@ test:do_test(
     end
         return test:execsql("ANALYZE")
     end, {
-        -- <10.2.2>    
+        -- <10.2.2>
         -- </10.2.2>
     })
 
@@ -717,7 +717,7 @@ test:do_test(
     function()
         local a
         for i = 0, 100 do
-            if i % 10 == 0 then 
+            if i % 10 == 0 then
                 a = "\"ABC\""
             else
                 a = "\"DEF\""
@@ -732,7 +732,7 @@ test:do_test(
     })
 
 test:do_execsql_test(
-    "11.2", 
+    "11.2",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE a = '"def"' AND b = 3;
     ]], {
@@ -742,7 +742,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "11.3", 
+    "11.3",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE a = '"abc"' AND b = 3;
     ]], {
@@ -768,7 +768,7 @@ test:do_test(
     function()
         local a
         for i = 0, 100 do
-            if i % 10 == 0 then 
+            if i % 10 == 0 then
                 a = "\"ABC\""
             else
                 a = "\"DEF\""
@@ -783,7 +783,7 @@ test:do_test(
     })
 
 test:do_execsql_test(
-    "11.6", 
+    "11.6",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE a = '"def"' AND b = 3;
     ]], {
@@ -793,7 +793,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "11.7", 
+    "11.7",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE a = '"abc"' COLLATE "unicode_ci" AND b = 3;
     ]], {
@@ -803,7 +803,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "11.8", 
+    "11.8",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE a COLLATE "unicode_ci" = '"abc"' AND b = 3;
     ]], {
@@ -829,7 +829,7 @@ test:do_test(
     function()
         local a
         for i = 0, 100 do
-            if i % 10 == 0 then 
+            if i % 10 == 0 then
                 a = "\"ABC\""
             else
                 a = "\"DEF\""
@@ -844,7 +844,7 @@ test:do_test(
     })
 
 test:do_execsql_test(
-    "12.2", 
+    "12.2",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE x = 'abcdef' AND a = '"def"' AND b = 3;
     ]], {
@@ -854,7 +854,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "12.3", 
+    "12.3",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE x = 'abcdef' AND a = '"abc"' AND b = 3;
     ]], {
@@ -880,7 +880,7 @@ test:do_test(
     function()
         local a
         for i = 0, 100 do
-            if i % 10 == 0 then 
+            if i % 10 == 0 then
                 a = "\"ABC\""
             else
                 a = "\"DEF\""
@@ -895,7 +895,7 @@ test:do_test(
     })
 
 test:do_execsql_test(
-    "12.6", 
+    "12.6",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE x = 'abcdef' AND a = 'def' AND b = 3;
     ]], {
@@ -905,7 +905,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "12.7", 
+    "12.7",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE x= 'abcdef' AND a = '"abc"' COLLATE "unicode_ci" AND b = 3;
     ]], {
@@ -915,7 +915,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "12.8", 
+    "12.8",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE x = 'abcdef' AND a COLLATE "unicode_ci" = '"abc"' AND b = 3;
     ]], {
@@ -991,8 +991,8 @@ test:do_execsql_test(
     })
 
 ---------------------------------------------------------------------------
--- Check also that affinities are taken into account when using stat4 data 
--- to estimate the number of rows scanned by any other constraint on a 
+-- Check also that affinities are taken into account when using stat4 data
+-- to estimate the number of rows scanned by any other constraint on a
 -- column other than the leftmost.
 --
 test:do_test(
@@ -1010,7 +1010,7 @@ test:do_test(
                 ANALYZE;
             ]])
         end, {
-        -- <14.1>    
+        -- <14.1>
         -- </14.1>
         })
 
@@ -1054,7 +1054,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     15.2,
     [[
-        SELECT * FROM x1; 
+        SELECT * FROM x1;
     ]], {
         -- <15.2>
         1, 2, 3, 4, 5, 6
@@ -1310,7 +1310,7 @@ test:do_test(
     function()
         for i = 1, 100 do
             test:execsql(string.format([[
-                INSERT INTO t2 VALUES(null, CASE WHEN %s < 80 THEN 'one' ELSE 'two' END, %s) 
+                INSERT INTO t2 VALUES(null, CASE WHEN %s < 80 THEN 'one' ELSE 'two' END, %s)
                 ]], i, i))
         end
         return test:execsql("ANALYZE")
@@ -1351,7 +1351,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     22.1,
     [[
-        WITH r(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM r WHERE x<=100) 
+        WITH r(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM r WHERE x<=100)
         INSERT INTO t3 SELECT CASE WHEN (x>45 AND x<96) THEN 'B' ELSE 'A' END,
             x, CASE WHEN (x<51) THEN 'one' ELSE 'two' END, x FROM r;
 
@@ -1436,8 +1436,8 @@ test:do_execsql_test(
     24.0,
     [[
         CREATE TABLE t5(c INT , d INT , b TEXT, e INT , a TEXT, PRIMARY KEY(a, b, c));
-        WITH data(a, b, c, d, e) AS (SELECT 'z', 'y', 0, 0, 0 UNION ALL 
-            SELECT a, CASE WHEN b='y' THEN 'n' ELSE 'y' END, c+1, e/250, e+1 FROM data WHERE e<1000) 
+        WITH data(a, b, c, d, e) AS (SELECT 'z', 'y', 0, 0, 0 UNION ALL
+            SELECT a, CASE WHEN b='y' THEN 'n' ELSE 'y' END, c+1, e/250, e+1 FROM data WHERE e<1000)
                 INSERT INTO t5(a, b, c, d, e) SELECT * FROM data;
         CREATE INDEX t5d ON t5(d);
         CREATE INDEX t5e ON t5(e);
@@ -1489,7 +1489,7 @@ test:do_execsql_test(
         DROP TABLE IF EXISTS t6;
         DROP TABLE IF EXISTS ints;
         CREATE TABLE t6(id INTEGER PRIMARY KEY AUTOINCREMENT, a INT , b INT );
-        WITH ints(i,j) AS (SELECT 1,1 UNION ALL SELECT i+1,j+1 FROM ints WHERE i<100) 
+        WITH ints(i,j) AS (SELECT 1,1 UNION ALL SELECT i+1,j+1 FROM ints WHERE i<100)
             INSERT INTO t6 SELECT null,* FROM ints;
         CREATE INDEX aa ON t6(a);
         CREATE INDEX bb ON t6(b);
@@ -1551,7 +1551,7 @@ test:do_execsql_test(
 
 
 ---------------------------------------------------------------------------
--- Check that a problem in they way stat4 data is used has been 
+-- Check that a problem in they way stat4 data is used has been
 -- resolved (see below).
 --
 -- Commented due to assertion(#2834)
@@ -1570,7 +1570,7 @@ test:do_test(
         for i = 0, 10 do
             test:execsql(string.format(
                 "WITH cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt WHERE x<100) INSERT INTO t1(id, x, y) SELECT null, %s, x FROM cnt;", i+10000))
-            test:execsql(string.format("INSERT INTO t1(id, x, y) SELECT null, %s, 100;", i+10000))    
+            test:execsql(string.format("INSERT INTO t1(id, x, y) SELECT null, %s, 100;", i+10000))
         end
         test:execsql([[
                 UPDATE t1 SET z = id / 20;
@@ -1608,7 +1608,7 @@ test:do_execsql_test(
 --
 --   sample=(x=10000, y=100) nLt=(10000 10099)
 --
--- There should be no other samples that start with (x=10000). So it knows 
+-- There should be no other samples that start with (x=10000). So it knows
 -- that (x=10000 AND y<50) must match somewhere between 0 and 99 rows, but
 -- know more than that. Guessing less than 20 is therefore unreasonable.
 --
@@ -1627,19 +1627,19 @@ test:do_execsql_test(
 
 -- This test - 26.2.* - tests that another manifestation of the same problem
 -- is no longer present in the library. Assuming:
--- 
+--
 --   CREATE INDEX t1xy ON t1(x, y)
 --
 -- and that have samples for index t1xy as follows:
 --
 --
 --   sample=('A', 70)        nEq=(100, 2)        nLt=(900, 970)
---   sample=('B', 70)        nEq=(100, 2)        nLt=(1000, 1070)    
+--   sample=('B', 70)        nEq=(100, 2)        nLt=(1000, 1070)
 --
 -- the planner should estimate that (x = 'B' AND y > 25) matches 76 rows
--- (70 * 2/3 + 30). Before, due to the problem, the planner was estimating 
+-- (70 * 2/3 + 30). Before, due to the problem, the planner was estimating
 -- that this matched 100 rows.
--- 
+--
 test:do_execsql_test(
     "26.2.1",
     [[
@@ -1649,14 +1649,14 @@ test:do_execsql_test(
         CREATE INDEX i2 ON t1(z);
 
 
-        WITH cnt(y) AS (SELECT 0 UNION ALL SELECT y+1 FROM cnt WHERE y<99), 
-            letters(x) AS (SELECT 'A' UNION SELECT 'B' UNION SELECT 'C' UNION SELECT 'D') 
+        WITH cnt(y) AS (SELECT 0 UNION ALL SELECT y+1 FROM cnt WHERE y<99),
+            letters(x) AS (SELECT 'A' UNION SELECT 'B' UNION SELECT 'C' UNION SELECT 'D')
                 INSERT INTO t1(id, x, y) SELECT null, x, y FROM letters, cnt;
 
-        WITH letters(x) AS (SELECT 'A' UNION SELECT 'B' UNION SELECT 'C' UNION SELECT 'D') 
+        WITH letters(x) AS (SELECT 'A' UNION SELECT 'B' UNION SELECT 'C' UNION SELECT 'D')
             INSERT INTO t1(id, x, y) SELECT null, x, 70 FROM letters;
 
-        WITH cnt(i) AS (SELECT 407 UNION ALL SELECT i+1 FROM cnt WHERE i<9999) 
+        WITH cnt(i) AS (SELECT 407 UNION ALL SELECT i+1 FROM cnt WHERE i<9999)
             INSERT INTO t1(id, x, y) SELECT i, i, i FROM cnt;
 
         UPDATE t1 SET z = (id / 95);
diff --git a/test/sql-tap/analyzeD.test.lua b/test/sql-tap/analyzeD.test.lua
index 12722a3d4..e0426b974 100755
--- a/test/sql-tap/analyzeD.test.lua
+++ b/test/sql-tap/analyzeD.test.lua
@@ -54,7 +54,7 @@ test:do_test(
 			ANALYZE;
 		]])
 	end, {
-        	-- <1.1> 
+        	-- <1.1>
         	-- </1.1>
     })
 
@@ -101,7 +101,7 @@ test:do_execsql_test(
 		UPDATE t1 SET a=13 WHERE a = 3001;
 		ANALYZE;
 	]], {
-        -- <1.5> 
+        -- <1.5>
         -- </1.5>
     })
 
@@ -120,11 +120,11 @@ test:do_test(
 	function()
 		test:execsql(" DELETE FROM \"_sql_stat1\" ")
 	end, {
-        -- <1.7> 
+        -- <1.7>
         -- </1.7>
    	})
 
--- Same test as 1.4, except this time the 7 rows that match the a=? condition 
+-- Same test as 1.4, except this time the 7 rows that match the a=? condition
 -- do not feature larger values than all rows in the stat4 table. So sql
 -- gets this right, even without stat1 data.
 test:do_execsql_test(
@@ -155,7 +155,7 @@ test:do_execsql_test(
 		SELECT * FROM "_sql_stat4" WHERE "tbl" = 'v';
 	]], {
 		-- <analyzeD-1.10>
-		
+
 		-- <analyzeD-1.10>
 	})
 
@@ -165,7 +165,7 @@ test:do_execsql_test(
 		SELECT * FROM "_sql_stat1" WHERE "tbl" = 'v';
 	]], {
 		-- <analyzeD-1.11>
-		
+
 		-- <analyzeD-1.11>
 	})
 
@@ -185,7 +185,7 @@ test:do_execsql_test(
 		SELECT * FROM "_sql_stat4" WHERE "tbl" = 'v';
 	]], {
 		-- <analyzeD-1.13>
-		
+
 		-- <analyzeD-1.13>
 	})
 
@@ -195,7 +195,7 @@ test:do_execsql_test(
 		SELECT * FROM "_sql_stat1" WHERE "tbl" = 'v';
 	]], {
 		-- <analyzeD-1.14>
-		
+
 		-- <analyzeD-1.14>
 	})
 
diff --git a/test/sql-tap/analyzeF.test.lua b/test/sql-tap/analyzeF.test.lua
index 19bb2176f..0b621a3ae 100755
--- a/test/sql-tap/analyzeF.test.lua
+++ b/test/sql-tap/analyzeF.test.lua
@@ -98,7 +98,7 @@ test:do_catchsql_test(
 -- Check that functions that accept zero arguments do not cause problems.
 --
 
-local function det4() 
+local function det4()
     return 4
 end
 
diff --git a/test/sql-tap/atof1.test.lua b/test/sql-tap/atof1.test.lua
index 78aca6557..92fcb0e9d 100755
--- a/test/sql-tap/atof1.test.lua
+++ b/test/sql-tap/atof1.test.lua
@@ -13,7 +13,7 @@ test:plan(9999)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- Tests of the sqlAtoF() function.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/autoinc.test.lua b/test/sql-tap/autoinc.test.lua
index 3f8000abd..aa457b502 100755
--- a/test/sql-tap/autoinc.test.lua
+++ b/test/sql-tap/autoinc.test.lua
@@ -613,7 +613,7 @@ test:do_catchsql_test(
     [[
             DROP TABLE IF EXISTS t2;
             CREATE TABLE t2(x INT PRIMARY KEY AUTOINCREMENT);
-            INSERT INTO t2 VALUES('asd'); 
+            INSERT INTO t2 VALUES('asd');
     ]], {
         -- <autoinc-10.2>
         1, "Type mismatch: can not convert asd to integer"
diff --git a/test/sql-tap/autoindex4.test.lua b/test/sql-tap/autoindex4.test.lua
index c2ca723b8..2c800969a 100755
--- a/test/sql-tap/autoindex4.test.lua
+++ b/test/sql-tap/autoindex4.test.lua
@@ -41,7 +41,7 @@ test:do_execsql_test(
         SELECT *, '|' FROM t1, t2 WHERE a=234 AND x=555;
     ]], {
         -- <autoindex4-1.1>
-        
+
         -- </autoindex4-1.1>
     })
 
@@ -71,7 +71,7 @@ test:do_execsql_test(
         SELECT *, '|' FROM t1 LEFT JOIN t2 WHERE a=234 AND x=555;
     ]], {
         -- <autoindex4-1.4>
-        
+
         -- </autoindex4-1.4>
     })
 
@@ -97,7 +97,7 @@ test:do_execsql_test(
 -- Ticket [2326c258d02ead33d]
 -- Two joins, one with and the other without an ORDER BY clause.
 -- The one without ORDER BY correctly returns two rows of result.
--- The one with ORDER BY returns no rows. 
+-- The one with ORDER BY returns no rows.
 --
 test:do_execsql_test(
     "autoindex4-3.0",
diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua
index dd93eed21..9ea0b2d4a 100755
--- a/test/sql-tap/colname.test.lua
+++ b/test/sql-tap/colname.test.lua
@@ -64,7 +64,7 @@ test:do_test(
             INSERT INTO txyz VALUES(4,5,6);
             CREATE TABLE tboth(a INT PRIMARY KEY,b INT,c INT,x INT,y INT,z INT);
             INSERT INTO tboth VALUES(11,12,13,14,15,16);
-            CREATE VIEW v1 AS SELECT tabC.a, txyZ.x, * 
+            CREATE VIEW v1 AS SELECT tabC.a, txyZ.x, *
               FROM tabc, txyz ORDER BY 1 LIMIT 1;
             CREATE VIEW v2 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
               FROM tabc, txyz, tboth ORDER BY 1 LIMIT 1;
@@ -166,7 +166,7 @@ test:do_test(
             UPDATE "_session_settings" SET "value" = false WHERE "name" = 'sql_full_column_names';
             CREATE VIEW v3 AS SELECT tabC.a, txyZ.x, *
               FROM tabc, txyz ORDER BY 1 LIMIT 1;
-            CREATE VIEW v4 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, * 
+            CREATE VIEW v4 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
               FROM tabc, txyz, tboth ORDER BY 1 LIMIT 1;
         ]]
         return test:execsql2 [[
@@ -286,7 +286,7 @@ test:do_test(
             UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_full_column_names';
             CREATE VIEW v5 AS SELECT tabC.a, txyZ.x, *
               FROM tabc, txyz ORDER BY 1 LIMIT 1;
-            CREATE VIEW v6 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, * 
+            CREATE VIEW v6 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
               FROM tabc, txyz, tboth ORDER BY 1 LIMIT 1;
         ]]
         return test:execsql2 [[
diff --git a/test/sql-tap/contrib01.test.lua b/test/sql-tap/contrib01.test.lua
index 74c5af54c..cc50d027c 100755
--- a/test/sql-tap/contrib01.test.lua
+++ b/test/sql-tap/contrib01.test.lua
@@ -18,7 +18,7 @@ test:plan(3)
 -- This file contains test cases that were contributed on the sql-users
 -- mailing list on 2013-06-05 by Mi Chen at mi.chen@echostar.com.
 --
--- At the time it was contributed, this test failed on trunk, but 
+-- At the time it was contributed, this test failed on trunk, but
 -- worked on the NGQP.
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -72,7 +72,7 @@ test:do_test(
         ]]
     end, {
         -- <contrib01-1.0>
-        
+
         -- </contrib01-1.0>
     })
 
diff --git a/test/sql-tap/date.test.lua b/test/sql-tap/date.test.lua
index 0b37d52f8..ffa229959 100755
--- a/test/sql-tap/date.test.lua
+++ b/test/sql-tap/date.test.lua
@@ -234,13 +234,13 @@ datetest(5.15, "datetime('1994-04-16 14:00:00 +05:00 Z')", "NULL")
 -- and in New York.)
 --
 -- On non-Vista Windows platform, '2006-03-31' is treated incorrectly as being
--- in DST giving a 4 hour offset instead of 5.  In 2007, DST was extended to 
+-- in DST giving a 4 hour offset instead of 5.  In 2007, DST was extended to
 -- start three weeks earlier (second Sunday in March) and end one week
 -- later (first Sunday in November).  Older Windows systems apply this
 -- new rule incorrectly to dates prior to 2007.
 --
 -- It might be argued that this is masking a problem on non-Vista Windows
--- platform.  A ticket has already been opened for this issue 
+-- platform.  A ticket has already been opened for this issue
 -- (http://www.sql.org/cvstrac/tktview?tn=2322).  This is just to prevent
 -- more confusion/reports of the issue.
 --
diff --git a/test/sql-tap/default.test.lua b/test/sql-tap/default.test.lua
index 1832e3af7..9c15220eb 100755
--- a/test/sql-tap/default.test.lua
+++ b/test/sql-tap/default.test.lua
@@ -26,7 +26,7 @@ test:do_execsql_test(
 	"default-1.1",
 	[[
 		CREATE TABLE t1(
-		rowid INTEGER PRIMARY KEY AUTOINCREMENT, 
+		rowid INTEGER PRIMARY KEY AUTOINCREMENT,
 		a INTEGER,
 		b SCALAR DEFAULT x'6869'
 		);
@@ -44,7 +44,7 @@ test:do_execsql_test(
 	"default-1.2",
 	[[
 	CREATE TABLE t2(
-	rowid INTEGER PRIMARY KEY AUTOINCREMENT, 
+	rowid INTEGER PRIMARY KEY AUTOINCREMENT,
 	x INTEGER,
 	y INTEGER DEFAULT NULL
 	);
@@ -60,7 +60,7 @@ test:do_catchsql_test(
 	"default-1.3",
 	[[
 	CREATE TABLE t3(
-	rowid INTEGER PRIMARY KEY AUTOINCREMENT, 
+	rowid INTEGER PRIMARY KEY AUTOINCREMENT,
 	x INTEGER,
 	y INTEGER DEFAULT (max(x,5))
 	);
@@ -74,7 +74,7 @@ test:do_execsql_test(
 	"default-2.1",
 	[[
 	CREATE TABLE t4(
-	rowid INTEGER PRIMARY KEY AUTOINCREMENT, 
+	rowid INTEGER PRIMARY KEY AUTOINCREMENT,
 	c TEXT DEFAULT 'abc'
 	);
 	PRAGMA table_info(t4);
@@ -110,7 +110,7 @@ test:do_execsql_test(
 	g INTEGER DEFAULT( 3600*12 )
 	);
 	INSERT INTO t3 VALUES(null, 5, 'row1', 5.25, 8.67, '321', 432);
-	SELECT a, typeof(a), b, typeof(b), c, typeof(c), 
+	SELECT a, typeof(a), b, typeof(b), c, typeof(c),
 	d, typeof(d), e, typeof(e), f, typeof(f),
 	g, typeof(g) FROM t3;
 	]], {
@@ -152,7 +152,7 @@ test:do_execsql_test(
 	-- </default-3.3>
 })
 
--- Do now allow bound parameters in new DEFAULT values. 
+-- Do now allow bound parameters in new DEFAULT values.
 -- Silently convert bound parameters to NULL in DEFAULT causes
 -- in the sql_master table, for backwards compatibility.
 --
diff --git a/test/sql-tap/delete3.test.lua b/test/sql-tap/delete3.test.lua
index e9d1f5a21..eb20ebd52 100755
--- a/test/sql-tap/delete3.test.lua
+++ b/test/sql-tap/delete3.test.lua
@@ -47,7 +47,7 @@ test:do_execsql_test(
         INSERT INTO t1 SELECT x+131072 FROM t1;
         INSERT INTO t1 SELECT x+262144 FROM t1;
         COMMIT;
-        SELECT count(*) FROM t1;	
+        SELECT count(*) FROM t1;
     ]], {
         -- <delete3-1.1>
         524288
diff --git a/test/sql-tap/delete4.test.lua b/test/sql-tap/delete4.test.lua
index 14bdac151..7fa64e08e 100755
--- a/test/sql-tap/delete4.test.lua
+++ b/test/sql-tap/delete4.test.lua
@@ -123,7 +123,7 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES(8, 'four', 'iv');
     ]], {
         -- <3.1>
-        
+
         -- </3.1>
     })
 
@@ -143,8 +143,8 @@ test:do_execsql_test(
         -- </3.3>
     })
 
--- do_execsql_test 3.4 { 
---   PRAGMA integrity_check; 
+-- do_execsql_test 3.4 {
+--   PRAGMA integrity_check;
 -- } {ok}
 -- Between 2015-09-14 and 2015-09-28, the following test cases would result
 -- in corruption (wrong # of entries in index) due to a bug in the ONEPASS
@@ -160,7 +160,7 @@ test:do_execsql_test(
         DELETE FROM t4 WHERE col0=69 OR col0>7;
     ]], {
         -- <4.1>
-        
+
         -- </4.1>
     })
 
@@ -174,7 +174,7 @@ test:do_execsql_test(
         DELETE FROM t4 WHERE col0=69 OR col0>7;
     ]], {
         -- <4.2>
-        
+
         -- </4.2>
     })
 
@@ -189,7 +189,7 @@ test:do_execsql_test(
         DELETE FROM t4 WHERE col0=69 OR col0>7;
     ]], {
         -- <4.11>
-        
+
         -- </4.11>
     })
 
@@ -204,7 +204,7 @@ test:do_execsql_test(
         DELETE FROM t4 WHERE col0=69 OR col0>7;
     ]], {
         -- <4.12>
-        
+
         -- </4.12>
     })
 
diff --git a/test/sql-tap/distinct.test.lua b/test/sql-tap/distinct.test.lua
index 3b5bf550c..fefc8ff52 100755
--- a/test/sql-tap/distinct.test.lua
+++ b/test/sql-tap/distinct.test.lua
@@ -83,8 +83,8 @@ local function do_temptables_test(tn, sql, temptables)
 end
 
 ---------------------------------------------------------------------------
--- The following tests - distinct-1.* - check that the planner correctly 
--- detects cases where a UNIQUE index means that a DISTINCT clause is 
+-- The following tests - distinct-1.* - check that the planner correctly
+-- detects cases where a UNIQUE index means that a DISTINCT clause is
 -- redundant. Currently the planner only detects such cases when there
 -- is a single table in the FROM clause.
 --
@@ -147,7 +147,7 @@ for _, val in ipairs(data) do
 end
 ---------------------------------------------------------------------------
 -- The following tests - distinct-2.* - test cases where an index is
--- used to deliver results in order of the DISTINCT expressions. 
+-- used to deliver results in order of the DISTINCT expressions.
 --
 --X(143, "X!cmd", [=[["drop_all_tables"]]=])
 test:execsql([[
diff --git a/test/sql-tap/e_delete.test.lua b/test/sql-tap/e_delete.test.lua
index d1cf2a79f..71e605513 100755
--- a/test/sql-tap/e_delete.test.lua
+++ b/test/sql-tap/e_delete.test.lua
@@ -14,7 +14,7 @@ test:plan(18)
 --
 -------------------------------------------------------------------------
 --
--- This file implements tests to verify that the "testable statements" in 
+-- This file implements tests to verify that the "testable statements" in
 -- the lang_delete.html document are correct.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index 1260b321c..a748001ce 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -3143,14 +3143,14 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES(4, NULL, NULL);
     ]], {
         -- <e_expr-34.1>
-        
+
         -- </e_expr-34.1>
     })
 
 -- EVIDENCE-OF: R-25588-27181 The EXISTS operator always evaluates to one
 -- of the integer values 0 and 1.
 --
--- This statement is not tested by itself. Instead, all e_expr-34.* tests 
+-- This statement is not tested by itself. Instead, all e_expr-34.* tests
 -- following this point explicitly test that specific invocations of EXISTS
 -- return either integer 0 or integer 1.
 --
@@ -3233,7 +3233,7 @@ test:do_execsql_test(
         INSERT INTO t22 VALUES('three', NULL);
     ]], {
         -- <e_expr-35.0>
-        
+
         -- </e_expr-35.0>
     })
 
@@ -3248,10 +3248,10 @@ do_expr_test("e_expr-35.1.1", " (SELECT 35)   ", "integer", 35)
 do_expr_test("e_expr-35.1.2", " (SELECT NULL) ", "null", "")
 do_expr_test("e_expr-35.1.3", " (SELECT count(*) FROM t22) ", "integer", 2)
 do_expr_test("e_expr-35.1.4", " (SELECT 4 FROM t22 LIMIT 1) ", "integer", 4)
-do_expr_test("e_expr-35.1.5", [[ 
+do_expr_test("e_expr-35.1.5", [[
   (SELECT b FROM t22 UNION SELECT a+1 FROM t22 LIMIT 1)
 ]], "null", "")
-do_expr_test("e_expr-35.1.6", [[ 
+do_expr_test("e_expr-35.1.6", [[
   (SELECT a FROM t22 UNION SELECT COALESCE(b, 55) FROM t22 ORDER BY 1 LIMIT 1)
 ]], "integer", 55)
 -- EVIDENCE-OF: R-46899-53765 A SELECT used as a scalar quantity must
@@ -3292,7 +3292,7 @@ test:do_execsql_test(
         INSERT INTO t4 VALUES(3, 'three');
     ]], {
         -- <e_expr-36.3.1>
-        
+
         -- </e_expr-36.3.1>
     })
 
diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua
index 66eaa5339..35eb162e8 100755
--- a/test/sql-tap/e_select1.test.lua
+++ b/test/sql-tap/e_select1.test.lua
@@ -14,7 +14,7 @@ test:plan(509)
 --
 -------------------------------------------------------------------------
 --
--- This file implements tests to verify that the "testable statements" in 
+-- This file implements tests to verify that the "testable statements" in
 -- the lang_select.html document are correct.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
@@ -43,7 +43,7 @@ test:do_execsql_test(
         INSERT INTO t4 VALUES('b', 2);
     ]], {
         -- <e_select-1.0>
-        
+
         -- </e_select-1.0>
     })
 
diff --git a/test/sql-tap/eqp.test.lua b/test/sql-tap/eqp.test.lua
index bc46a920e..811ef046f 100755
--- a/test/sql-tap/eqp.test.lua
+++ b/test/sql-tap/eqp.test.lua
@@ -101,7 +101,7 @@ test:do_eqp_test(
         {0, 0, 0, "SCAN TABLE T3 (~1048576 rows)"},
         {0, 0, 0, "USE TEMP B-TREE FOR GROUP BY"},
         {0, 0, 0, "USE TEMP B-TREE FOR DISTINCT"},
-        
+
         -- </1.6>
     })
 
@@ -113,7 +113,7 @@ test:do_eqp_test(
         -- <1.7>
         {0, 0, 1, "SCAN SUBQUERY 1 (~1 row)"},
         {0, 1, 0, "SCAN TABLE T3 (~1048576 rows)"},
-        
+
         -- </1.7>
     })
 
@@ -126,7 +126,7 @@ test:do_eqp_test(
         {1, 0, 0, "COMPOUND SUBQUERIES 2 AND 3 USING TEMP B-TREE (UNION)"},
         {0, 0, 1, "SCAN SUBQUERY 1 (~1 row)"},
         {0, 1, 0, "SCAN TABLE T3 (~1048576 rows)"},
-        
+
         -- </1.8>
     })
 
@@ -154,7 +154,7 @@ test:do_eqp_test(
         {1, 0, 0, "COMPOUND SUBQUERIES 2 AND 3 USING TEMP B-TREE (INTERSECT)"},
         {0, 0, 1, "SCAN SUBQUERY 1 (~1 row)"},
         {0, 1, 0, "SCAN TABLE T3 (~1048576 rows)"},
-        
+
         -- </1.10>
     })
 
@@ -168,7 +168,7 @@ test:do_eqp_test(
         {1, 0, 0, "COMPOUND SUBQUERIES 2 AND 3 (UNION ALL)"},
         {0, 0, 1, "SCAN SUBQUERY 1 (~1 row)"},
         {0, 1, 0, "SCAN TABLE T3 (~1048576 rows)"},
-        
+
         -- </1.11>
     })
 
@@ -243,7 +243,7 @@ test:do_eqp_test(
         {0, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
         {0, 0, 0, "EXECUTE SCALAR SUBQUERY 1"},
         {1, 0, 0, "SCAN TABLE T1 AS SUB (~1048576 rows)"},
-        
+
         -- </3.1.1>
     })
 
@@ -256,7 +256,7 @@ test:do_eqp_test(
         {0, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
         {0, 0, 0, "EXECUTE SCALAR SUBQUERY 1"},
         {1, 0, 0, "SCAN TABLE T1 AS SUB (~1048576 rows)"},
-        
+
         -- </3.1.2>
     })
 
@@ -270,7 +270,7 @@ test:do_eqp_test(
         {0, 0, 0, "EXECUTE SCALAR SUBQUERY 1"},
         {1, 0, 0, "SCAN TABLE T1 AS SUB (~1048576 rows)"},
         {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"},
-        
+
         -- </3.1.3>
     })
 
@@ -283,7 +283,7 @@ test:do_eqp_test(
         {0, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
         {0, 0, 0, "EXECUTE SCALAR SUBQUERY 1"},
         {1, 0, 0, "SCAN TABLE T2 USING COVERING INDEX T2I1 (~1048576 rows)"},
-        
+
         -- </3.1.4>
     })
 
@@ -291,18 +291,18 @@ test:do_eqp_test("3.2.1", [[
   SELECT * FROM (SELECT * FROM t1 ORDER BY x LIMIT 10) ORDER BY y LIMIT 5
 ]], {
     {1, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
-    {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"}, 
+    {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"},
     {0, 0, 0, "SCAN SUBQUERY 1 (~1 row)"},
     {0, 0, 0, "USE TEMP B-TREE FOR ORDER BY"},
 })
 test:do_eqp_test("3.2.2", [[
-  SELECT * FROM 
+  SELECT * FROM
     (SELECT * FROM t1 ORDER BY x LIMIT 10) AS x1,
     (SELECT * FROM t2 ORDER BY x LIMIT 10) AS x2
   ORDER BY x2.y LIMIT 5
 ]], {
     {1, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
-    {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"}, 
+    {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"},
     {2, 0, 0, "SCAN TABLE T2 USING COVERING INDEX T2I1 (~1048576 rows)"},
     {0, 0, 0, "SCAN SUBQUERY 1 AS X1 (~1 row)"},
     {0, 1, 1, "SCAN SUBQUERY 2 AS X2 (~1 row)"},
@@ -312,21 +312,21 @@ test:do_eqp_test("3.3.1", [[
   SELECT * FROM t1 WHERE y IN (SELECT y FROM t2)
 ]], {
     {0, 0, 0, "SCAN TABLE T1 (~983040 rows)"},
-    {0, 0, 0, "EXECUTE LIST SUBQUERY 1"}, 
+    {0, 0, 0, "EXECUTE LIST SUBQUERY 1"},
     {1, 0, 0, "SCAN TABLE T2 (~1048576 rows)"},
 })
 test:do_eqp_test("3.3.2", [[
   SELECT * FROM t1 WHERE y IN (SELECT y FROM t2 WHERE t1.x!=t2.x)
 ]], {
     {0, 0, 0, "SCAN TABLE T1 (~983040 rows)"},
-    {0, 0, 0, "EXECUTE CORRELATED LIST SUBQUERY 1"}, 
+    {0, 0, 0, "EXECUTE CORRELATED LIST SUBQUERY 1"},
     {1, 0, 0, "SCAN TABLE T2 (~983040 rows)"},
 })
 test:do_eqp_test("3.3.3", [[
   SELECT * FROM t1 WHERE EXISTS (SELECT y FROM t2 WHERE t1.x!=t2.x)
 ]], {
     {0, 0, 0, "SCAN TABLE T1 (~983040 rows)"},
-    {0, 0, 0, "EXECUTE CORRELATED SCALAR SUBQUERY 1"}, 
+    {0, 0, 0, "EXECUTE CORRELATED SCALAR SUBQUERY 1"},
     {1, 0, 0, "SCAN TABLE T2 (~983040 rows)"},
 })
 ---------------------------------------------------------------------------
@@ -341,7 +341,7 @@ test:do_eqp_test(
         {1, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
         {2, 0, 0, "SCAN TABLE T2 (~1048576 rows)"},
         {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 (UNION ALL)"},
-        
+
         -- </4.1.1>
     })
 
@@ -355,7 +355,7 @@ test:do_eqp_test(
         {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"},
         {2, 0, 0, "SCAN TABLE T2 USING COVERING INDEX T2I1 (~1048576 rows)"},
         {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 (UNION ALL)"},
-        
+
         -- </4.1.2>
     })
 
@@ -370,7 +370,7 @@ test:do_eqp_test(
         {2, 0, 0, "SCAN TABLE T2 USING COVERING INDEX T2I1 (~1048576 rows)"},
         {2, 0, 0, "USE TEMP B-TREE FOR RIGHT PART OF ORDER BY"},
         {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 (UNION)"},
-        
+
         -- </4.1.3>
     })
 
@@ -385,7 +385,7 @@ test:do_eqp_test(
         {2, 0, 0, "SCAN TABLE T2 USING COVERING INDEX T2I1 (~1048576 rows)"},
         {2, 0, 0, "USE TEMP B-TREE FOR RIGHT PART OF ORDER BY"},
         {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 (INTERSECT)"},
-        
+
         -- </4.1.4>
     })
 
@@ -471,7 +471,7 @@ test:do_eqp_test(
         {1, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
         {2, 0, 0, "SCAN TABLE T2 (~1048576 rows)"},
         {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 USING TEMP B-TREE (UNION)"},
-        
+
         -- </4.3.1>
     })
 
@@ -506,7 +506,7 @@ test:do_eqp_test(
     })
 
 ---------------------------------------------------------------------------
--- This next block of tests verifies that the examples on the 
+-- This next block of tests verifies that the examples on the
 -- lang_explain.html page are correct.
 --
 test:drop_all_tables()
@@ -530,7 +530,7 @@ test:do_eqp_test("5.1.1", "SELECT a, b FROM t1 WHERE a=1", {
 test:do_execsql_test(
     "5.2.0",
     [[
-        CREATE INDEX i1 ON t1(a) 
+        CREATE INDEX i1 ON t1(a)
     ]])
 
 test:do_eqp_test("5.2.1", "SELECT a, b FROM t1 WHERE a=1", {
@@ -543,7 +543,7 @@ test:do_eqp_test("5.2.1", "SELECT a, b FROM t1 WHERE a=1", {
 test:do_execsql_test(
     "5.3.0",
     [[
-        CREATE INDEX i2 ON t1(a, b) 
+        CREATE INDEX i2 ON t1(a, b)
     ]])
 
 test:do_eqp_test("5.3.1", "SELECT a, b FROM t1 WHERE a=1", {
@@ -682,9 +682,9 @@ test:do_eqp_test("5.13", "SELECT a FROM t1 EXCEPT SELECT d FROM t2 ORDER BY 1",
     {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 (EXCEPT)"},
 })
 -- #-------------------------------------------------------------------------
--- # The following tests - eqp-6.* - test that the example C code on 
+-- # The following tests - eqp-6.* - test that the example C code on
 -- # documentation page eqp.html works. The C code is duplicated in test1.c
--- # and wrapped in Tcl command [print_explain_query_plan] 
+-- # and wrapped in Tcl command [print_explain_query_plan]
 -- #
 -- set boilerplate {
 --   proc explain_query_plan {db sql} {
diff --git a/test/sql-tap/func5.test.lua b/test/sql-tap/func5.test.lua
index b1e246ccc..9b1526aaf 100755
--- a/test/sql-tap/func5.test.lua
+++ b/test/sql-tap/func5.test.lua
@@ -53,7 +53,7 @@ test:do_execsql_test(
 -- and it really is non-deterministic, returning a different result each
 -- time.  But counter2() is marked as deterministic, so it does get factored
 -- out of the loop.  counter2() has the same implementation as counter1(),
--- returning a different result on each invocation, but because it is 
+-- returning a different result on each invocation, but because it is
 -- only invoked once outside of the loop, it appears to return the same
 -- result multiple times.
 --
diff --git a/test/sql-tap/icu.test.lua b/test/sql-tap/icu.test.lua
index 4e25ba7c5..f02b8a8b0 100755
--- a/test/sql-tap/icu.test.lua
+++ b/test/sql-tap/icu.test.lua
@@ -96,7 +96,7 @@ if (0 > 0)
             INSERT INTO fruit VALUES('yamot');
         ]], {
             -- <icu-4.1>
-            
+
             -- </icu-4.1>
         })
 
@@ -130,7 +130,7 @@ if (0 > 0)
         })
 
     ---------------------------------------------------------------------------
-    -- Test that it is not possible to call the ICU regex() function with 
+    -- Test that it is not possible to call the ICU regex() function with
     -- anything other than exactly two arguments. See also:
     --
     --   http://src.chromium.org/viewvc/chrome/trunk/src/third_party/sql/icu-regexp.patch?revision=34807&view=markup
@@ -146,7 +146,7 @@ if (0 > 0)
     test:do_catchsql_test(
         "icu-5.2",
         [=[
-            SELECT regexp('a[abc]c.*') 
+            SELECT regexp('a[abc]c.*')
         ]=], {
             -- <icu-5.2>
             1, "wrong number of arguments to function REGEXP()"
@@ -156,7 +156,7 @@ if (0 > 0)
     test:do_catchsql_test(
         "icu-5.3",
         [=[
-            SELECT regexp('a[abc]c.*', 'abc', 'c') 
+            SELECT regexp('a[abc]c.*', 'abc', 'c')
         ]=], {
             -- <icu-5.3>
             1, "wrong number of arguments to function REGEXP()"
diff --git a/test/sql-tap/in1.test.lua b/test/sql-tap/in1.test.lua
index e889844dc..4b51da6e8 100755
--- a/test/sql-tap/in1.test.lua
+++ b/test/sql-tap/in1.test.lua
@@ -200,7 +200,7 @@ test:do_execsql_test(
         SELECT a FROM t1 WHERE b IN (GREATEST(5,10),20)
     ]], {
         -- <in-2.9>
-        
+
         -- </in-2.9>
     })
 
@@ -210,7 +210,7 @@ test:do_execsql_test(
         SELECT a FROM t1 WHERE LEAST(0, CAST(b IN (a,30) AS INT)) <> 0
     ]], {
         -- <in-2.10>
-        
+
         -- </in-2.10>
     })
 
@@ -266,7 +266,7 @@ test:do_test(
     "in-4.1",
     function()
         test:execsql [[
-            UPDATE t1 SET b=b*2 
+            UPDATE t1 SET b=b*2
             WHERE b IN (SELECT b FROM t1 WHERE a>8)
         ]]
         return test:execsql "SELECT b FROM t1 ORDER BY b"
@@ -448,7 +448,7 @@ test:do_execsql_test(
         SELECT a FROM t1 WHERE a IN ();
     ]], {
         -- <in-7.1>
-        
+
         -- </in-7.1>
     })
 
@@ -478,7 +478,7 @@ test:do_execsql_test(
         SELECT a FROM t1 WHERE a IN (5) AND b IN ();
     ]], {
         -- <in-7.4>
-        
+
         -- </in-7.4>
     })
 
@@ -498,7 +498,7 @@ test:do_execsql_test(
         SELECT a FROM ta WHERE a IN ();
     ]], {
         -- <in-7.6.1>
-        
+
         -- </in-7.6.1>
     })
 
@@ -529,7 +529,7 @@ test:do_execsql_test(
         SELECT * FROM ta LEFT JOIN tb ON (ta.b=tb.b) WHERE ta.a IN ();
     ]], {
         -- <in-7.8.1>
-        
+
         -- </in-7.8.1>
     })
 
@@ -561,7 +561,7 @@ test:do_execsql_test(
     [[
         CREATE TABLE t4 (a INTEGER PRIMARY KEY);
         INSERT INTO t4 SELECT a FROM tb;
-        SELECT * FROM t4;    
+        SELECT * FROM t4;
     ]], {
         -- <in-9.1>
         1, 2, 3, 5, 7, 9, 11
@@ -665,7 +665,7 @@ test:do_execsql_test(
         CREATE TABLE t3(a  INT PRIMARY KEY, b INT , c INT );
     ]], {
         -- <in-12.1>
-        
+
         -- </in-12.1>
     })
 
@@ -843,12 +843,12 @@ test:do_catchsql_test(
 
 --ifcapable compound
 --------------------------------------------------------------------------
--- The following tests check that NULL is handled correctly when it 
+-- The following tests check that NULL is handled correctly when it
 -- appears as part of a set of values on the right-hand side of an
 -- IN or NOT IN operator.
 --
 -- When it appears in such a set, NULL is handled as an "unknown value".
--- If, because of the unknown value in the set, the result of the expression 
+-- If, because of the unknown value in the set, the result of the expression
 -- cannot be determined, then it itself evaluates to NULL.
 --
 -- Warm body test to demonstrate the principles being tested:
@@ -857,7 +857,7 @@ test:do_test(
     "in-13.1",
     function()
         --  db("nullvalue", '')
-        return test:execsql [[ SELECT 
+        return test:execsql [[ SELECT
     1 IN (NULL, 1, 2),     -- The value 1 is a member of the set, return true.
     3 IN (NULL, 1, 2),     -- Ambiguous, return NULL.
     1 NOT IN (NULL, 1, 2), -- The value 1 is a member of the set, return false.
@@ -880,14 +880,14 @@ test:do_execsql_test(
         INSERT INTO t7 VALUES(5, NULL, 5, 5);
     ]], {
         -- <in-13.2>
-        
+
         -- </in-13.2>
     })
 
 test:do_execsql_test(
     "in-13.3",
     [[
-        SELECT 2 IN (SELECT a FROM t7) 
+        SELECT 2 IN (SELECT a FROM t7)
     ]], {
         -- <in-13.3>
         true
@@ -897,7 +897,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in-13.4",
     [[
-        SELECT 6 IN (SELECT a FROM t7) 
+        SELECT 6 IN (SELECT a FROM t7)
     ]], {
         -- <in-13.4>
         ""
@@ -907,7 +907,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in-13.5",
     [[
-        SELECT 2 IN (SELECT b FROM t7) 
+        SELECT 2 IN (SELECT b FROM t7)
     ]], {
         -- <in-13.5>
         true
@@ -917,7 +917,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in-13.6",
     [[
-        SELECT 6 IN (SELECT b FROM t7) 
+        SELECT 6 IN (SELECT b FROM t7)
     ]], {
         -- <in-13.6>
         false
@@ -927,7 +927,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in-13.7",
     [[
-        SELECT 2 IN (SELECT c FROM t7) 
+        SELECT 2 IN (SELECT c FROM t7)
     ]], {
         -- <in-13.7>
         true
@@ -937,7 +937,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in-13.8",
     [[
-        SELECT 6 IN (SELECT c FROM t7) 
+        SELECT 6 IN (SELECT c FROM t7)
     ]], {
         -- <in-13.8>
         false
@@ -964,8 +964,8 @@ test:do_execsql_test(
     "in-13.10",
     [[
         SELECT b IN (
-          SELECT inside.a 
-          FROM t7 AS inside 
+          SELECT inside.a
+          FROM t7 AS inside
           WHERE inside.b BETWEEN outside.b+1 AND outside.b+2
         )
         FROM t7 AS outside ORDER BY b;
@@ -979,8 +979,8 @@ test:do_execsql_test(
     "in-13.11",
     [[
         SELECT b NOT IN (
-          SELECT inside.a 
-          FROM t7 AS inside 
+          SELECT inside.a
+          FROM t7 AS inside
           WHERE inside.b BETWEEN outside.b+1 AND outside.b+2
         )
         FROM t7 AS outside ORDER BY b;
@@ -1069,7 +1069,7 @@ test:do_catchsql_test(
 --         return db("nullvalue", "")
 --     end, {
 --         -- <in-13.X>
-        
+
 --         -- </in-13.X>
 --     })
 
diff --git a/test/sql-tap/in2.test.lua b/test/sql-tap/in2.test.lua
index dcdf4b0ed..9cddd2249 100755
--- a/test/sql-tap/in2.test.lua
+++ b/test/sql-tap/in2.test.lua
@@ -25,7 +25,7 @@ test:do_execsql_test(
         CREATE TABLE a(i INTEGER PRIMARY KEY, a INT);
     ]], {
         -- <in2-1>
-        
+
         -- </in2-1>
     })
 
@@ -62,7 +62,7 @@ test:do_test(
   -- ]=])
     end, {
         -- <in2-2>
-        
+
         -- </in2-2>
     })
 
@@ -77,11 +77,11 @@ test:do_test(
 -- Records are inserted in sorted order.
 --
 -- The string of zero-length is stored in a b-tree cell with 3 bytes
--- of payload. Moving this cell from a leaf node to a internal node 
--- during b-tree balancing was causing an assertion failure. 
+-- of payload. Moving this cell from a leaf node to a internal node
+-- during b-tree balancing was causing an assertion failure.
 --
--- This bug only applied to b-trees generated to evaluate IN (..) 
--- clauses, as it is impossible for persistent b-trees (SQL tables + 
+-- This bug only applied to b-trees generated to evaluate IN (..)
+-- clauses, as it is impossible for persistent b-trees (SQL tables +
 -- indices) to contain cells smaller than 4 bytes.
 --
 for ii=3,N-1 do
diff --git a/test/sql-tap/in3.test.lua b/test/sql-tap/in3.test.lua
index 1dcf7c8e3..5f3f543af 100755
--- a/test/sql-tap/in3.test.lua
+++ b/test/sql-tap/in3.test.lua
@@ -13,7 +13,7 @@ test:plan(28)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- This file tests the optimisations made in November 2007 of expressions 
+-- This file tests the optimisations made in November 2007 of expressions
 -- of the following form:
 --
 --     <value> IN (SELECT <column> FROM <table>)
@@ -64,7 +64,7 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES(5, 6);
     ]], {
         -- <in3-1.1>
-        
+
         -- </in3-1.1>
     })
 
@@ -97,7 +97,7 @@ test:do_test(
     })
 
 -- Because none of the sub-select queries in the following statements
--- match the pattern ("SELECT <column> FROM <table>"), the following do 
+-- match the pattern ("SELECT <column> FROM <table>"), the following do
 -- require a temp table.
 --
 -- do_test in3-1.6 {
@@ -146,7 +146,7 @@ test:do_test(
         -- </in3-1.10>
     })
 
--- These do use the temp-table. Adding the LIMIT clause means the 
+-- These do use the temp-table. Adding the LIMIT clause means the
 -- ORDER BY cannot be ignored.
 test:do_test(
     "in3-1.11",
@@ -198,7 +198,7 @@ test:do_execsql_test(
         -- </in3-1.14>
     })
 
--- The first of these queries has to use the temp-table, because the 
+-- The first of these queries has to use the temp-table, because the
 -- collation sequence used for the index on "t1.a" does not match the
 -- collation sequence used by the "IN" comparison. The second does not
 -- require a temp-table, because the collation sequences match.
@@ -261,8 +261,8 @@ test:do_execsql_test(
 -- } {}
 -- do_test in3-2.2 {
 --   execsql {
---     SELECT rowid 
---     FROM t1 
+--     SELECT rowid
+--     FROM t1
 --     WHERE rowid IN (SELECT rowid FROM t1 WHERE rowid IN (1, 2));
 --   }
 -- } {1 2}
@@ -273,7 +273,7 @@ test:do_execsql_test(
 -- } {2 4}
 -- do_test in3-2.4 {
 --   execsql {
---     SELECT rowid FROM t1 WHERE rowid IN 
+--     SELECT rowid FROM t1 WHERE rowid IN
 --        (select rowid from t1 where rowid IN (-1,2,4))
 --   }
 -- } {2 4}
@@ -305,7 +305,7 @@ test:do_test(
         ]]
     end, {
         -- <in3-3.1>
-        
+
         -- </in3-3.1>
     })
 
@@ -349,7 +349,7 @@ test:do_test(
 test:do_test(
     "in3-3.6",
     function()
-        -- Numeric affinity is applied to both sides before 
+        -- Numeric affinity is applied to both sides before
         -- the comparison.  Therefore it is possible to use index t1_i2.
         return exec_neph(" SELECT y IN (SELECT b FROM t1) FROM t2 ")
     end, {
@@ -361,7 +361,7 @@ test:do_test(
 test:do_test(
     "in3-3.7",
     function()
-        -- Numeric affinity is applied before the comparison takes place. 
+        -- Numeric affinity is applied before the comparison takes place.
         -- Making it impossible to use index t1_i3.
         return exec_neph(" SELECT y IN (SELECT c FROM t1) FROM t2 ")
     end, {
@@ -389,7 +389,7 @@ test:do_test(
         ]]
     end, {
         -- <in3-4.1>
-        
+
         -- </in3-4.1>
     })
 
@@ -447,7 +447,7 @@ test:do_execsql_test(
         DROP INDEX t3_i2 ON t3
     ]], {
         -- <in3-4.6>
-        
+
         -- </in3-4.6>
     })
 
@@ -457,14 +457,14 @@ test:do_execsql_test(
     "in3-5.1",
     [[
         CREATE TABLE Folders(
-          folderid INTEGER PRIMARY KEY, 
-          parentid INTEGER, 
-          rootid INTEGER, 
+          folderid INTEGER PRIMARY KEY,
+          parentid INTEGER,
+          rootid INTEGER,
           path VARCHAR(255)
         );
     ]], {
         -- <in3-5.1>
-        
+
         -- </in3-5.1>
     })
 
diff --git a/test/sql-tap/in4.test.lua b/test/sql-tap/in4.test.lua
index 7374f926e..8442944b9 100755
--- a/test/sql-tap/in4.test.lua
+++ b/test/sql-tap/in4.test.lua
@@ -24,7 +24,7 @@ test:do_execsql_test(
         CREATE INDEX i1 ON t1(a);
     ]], {
         -- <in4-1.1>
-        
+
         -- </in4-1.1>
     })
 
@@ -34,7 +34,7 @@ test:do_execsql_test(
         SELECT * FROM t1 WHERE a IN ('aaa', 'bbb', 'ccc');
     ]], {
         -- <in4-1.2>
-        
+
         -- </in4-1.2>
     })
 
@@ -83,14 +83,14 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(3, 'three');
     ]], {
         -- <in4-2.1>
-        
+
         -- </in4-2.1>
     })
 
 test:do_execsql_test(
     "in4-2.2",
     [[
-        SELECT b FROM t2 WHERE a IN (0, 2) 
+        SELECT b FROM t2 WHERE a IN (0, 2)
     ]], {
         -- <in4-2.2>
         "zero", "two"
@@ -100,7 +100,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-2.3",
     [[
-        SELECT b FROM t2 WHERE a IN (2, 0) 
+        SELECT b FROM t2 WHERE a IN (2, 0)
     ]], {
         -- <in4-2.3>
         "zero", "two"
@@ -110,7 +110,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-2.4",
     [[
-        SELECT b FROM t2 WHERE a IN (2, -1) 
+        SELECT b FROM t2 WHERE a IN (2, -1)
     ]], {
         -- <in4-2.4>
         "-one", "two"
@@ -120,7 +120,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-2.5",
     [[
-        SELECT b FROM t2 WHERE a IN (NULL, 3) 
+        SELECT b FROM t2 WHERE a IN (NULL, 3)
     ]], {
         -- <in4-2.5>
         "three"
@@ -130,7 +130,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-2.6",
     [[
-        SELECT b FROM t2 WHERE a IN (1.0, 2.1) 
+        SELECT b FROM t2 WHERE a IN (1.0, 2.1)
     ]], {
         -- <in4-2.6>
         "one"
@@ -150,7 +150,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-2.8",
     [[
-        SELECT b FROM t2 WHERE a IN ('', '0.0.0', '2') 
+        SELECT b FROM t2 WHERE a IN ('', '0.0.0', '2')
     ]], {
         -- <in4-2.8>
         "two"
@@ -161,9 +161,9 @@ test:do_execsql_test(
 --
 --    <expr> IN ()
 --
--- i.e. IN expressions with a literal empty set. 
--- 
--- This has led to crashes on more than one occasion. Test case in4-3.2 
+-- i.e. IN expressions with a literal empty set.
+--
+-- This has led to crashes on more than one occasion. Test case in4-3.2
 -- was added in reponse to a bug reported on the mailing list on 11/7/2008.
 -- See also tickets #3602 and #185.
 --
@@ -186,7 +186,7 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(4, NULL, NULL);
     ]], {
         -- <in4-3.1>
-        
+
         -- </in4-3.1>
     })
 
@@ -196,7 +196,7 @@ test:do_execsql_test(
         SELECT x FROM t1 WHERE id IN () AND x IN (SELECT x FROM t2 WHERE id=1)
     ]], {
         -- <in4-3.2>
-        
+
         -- </in4-3.2>
     })
 
@@ -212,34 +212,34 @@ test:do_test(
         return test:execsql " SELECT * FROM t3 WHERE x IN () "
     end, {
         -- <in4-3.3>
-        
+
         -- </in4-3.3>
     })
 
 test:do_execsql_test(
     "in4-3.4",
     [[
-        SELECT * FROM t3 WHERE x = 10 AND y IN () 
+        SELECT * FROM t3 WHERE x = 10 AND y IN ()
     ]], {
         -- <in4-3.4>
-        
+
         -- </in4-3.4>
     })
 
 test:do_execsql_test(
     "in4-3.5",
     [[
-        SELECT * FROM t3 WHERE x IN () AND y = 10 
+        SELECT * FROM t3 WHERE x IN () AND y = 10
     ]], {
         -- <in4-3.5>
-        
+
         -- </in4-3.5>
     })
 
 test:do_execsql_test(
     "in4-3.6",
     [[
-        SELECT * FROM t3 WHERE x IN () OR x = 10 
+        SELECT * FROM t3 WHERE x IN () OR x = 10
     ]], {
         -- <in4-3.6>
         10, 10, 10
@@ -249,27 +249,27 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-3.7",
     [[
-        SELECT * FROM t3 WHERE y IN () 
+        SELECT * FROM t3 WHERE y IN ()
     ]], {
         -- <in4-3.7>
-        
+
         -- </in4-3.7>
     })
 
 test:do_execsql_test(
     "in4-3.8",
     [[
-        SELECT x IN() AS a FROM t3 WHERE a 
+        SELECT x IN() AS a FROM t3 WHERE a
     ]], {
         -- <in4-3.8>
-        
+
         -- </in4-3.8>
     })
 
 test:do_execsql_test(
     "in4-3.9",
     [[
-        SELECT x IN() AS a FROM t3 WHERE NOT a 
+        SELECT x IN() AS a FROM t3 WHERE NOT a
     ]], {
         -- <in4-3.9>
         false, false
@@ -279,10 +279,10 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-3.10",
     [[
-        SELECT * FROM t3 WHERE oid IN () 
+        SELECT * FROM t3 WHERE oid IN ()
     ]], {
         -- <in4-3.10>
-        
+
         -- </in4-3.10>
     })
 
@@ -302,7 +302,7 @@ test:do_execsql_test(
         SELECT * FROM t3 WHERE x IN (1, 2) AND y IN ()
     ]], {
         -- <in4-3.12>
-        
+
         -- </in4-3.12>
     })
 
diff --git a/test/sql-tap/index3.test.lua b/test/sql-tap/index3.test.lua
index 909a184da..4a27a3fdd 100755
--- a/test/sql-tap/index3.test.lua
+++ b/test/sql-tap/index3.test.lua
@@ -48,7 +48,7 @@ test:do_execsql_test(
 -- integrity_check index3-1.4
 -- Backwards compatibility test:
 --
--- Verify that CREATE INDEX statements that use strings instead of 
+-- Verify that CREATE INDEX statements that use strings instead of
 -- identifiers for the the column names continue to work correctly.
 -- This is undocumented behavior retained for backwards compatiblity.
 --
@@ -61,11 +61,11 @@ test:do_execsql_test(
         CREATE INDEX t1c ON t1(c);
         CREATE INDEX t1d ON t1(d);
         WITH RECURSIVE c(x) AS (VALUES(1) UNION SELECT x+1 FROM c WHERE x<30)
-          INSERT INTO t1(a,b,c,d,e) 
+          INSERT INTO t1(a,b,c,d,e)
             SELECT x, printf('ab%03xxy',x), x, x, x FROM c;
     ]], {
         -- <index3-2.1>
-        
+
         -- </index3-2.1>
     })
 
diff --git a/test/sql-tap/index4.test.lua b/test/sql-tap/index4.test.lua
index cdc975e12..8fed92db1 100755
--- a/test/sql-tap/index4.test.lua
+++ b/test/sql-tap/index4.test.lua
@@ -50,7 +50,7 @@ test:do_execsql_test(
     ]])
 
 -- do_execsql_test 1.3 {
---   PRAGMA integrity_check 
+--   PRAGMA integrity_check
 -- } {ok}
 -- The same test again - this time with limited memory.
 --
@@ -91,11 +91,11 @@ test:do_execsql_test(
           INSERT INTO t1 SELECT randomblob(4202) FROM t1;     --   128
           INSERT INTO t1 SELECT randomblob(5202) FROM t1;     --   256
         COMMIT;
-        CREATE INDEX i1 ON t1(x); 
+        CREATE INDEX i1 ON t1(x);
         --PRAGMA integrity_check
     ]], {
         -- <1.6>
-        
+
         -- </1.6>
     })
 
@@ -107,11 +107,11 @@ test:do_execsql_test(
           CREATE TABLE t1(x TEXT primary key);
           INSERT INTO t1 VALUES('a');
         --COMMIT;
-        CREATE INDEX i1 ON t1(x); 
+        CREATE INDEX i1 ON t1(x);
         --PRAGMA integrity_check
     ]], {
         -- <1.7>
-        
+
         -- </1.7>
     })
 
@@ -125,11 +125,11 @@ if (1 > 0)
               DROP TABLE t1;
               CREATE TABLE t1(x INT primary key);
             --COMMIT;
-            CREATE INDEX i1 ON t1(x); 
+            CREATE INDEX i1 ON t1(x);
             --PRAGMA integrity_check
         ]], {
             -- <1.8>
-            
+
             -- </1.8>
         })
 
diff --git a/test/sql-tap/insert1.test.lua b/test/sql-tap/insert1.test.lua
index 094fae0e9..25258cfb4 100755
--- a/test/sql-tap/insert1.test.lua
+++ b/test/sql-tap/insert1.test.lua
@@ -141,7 +141,7 @@ end, {
 -- do_test insert-2.1 {
 --   execsql {
 --     CREATE TABLE test2(
---       f1 int default -111, 
+--       f1 int default -111,
 --       f2 real default +4.32,
 --       f3 int default +222,
 --       f4 int default 7.89
@@ -165,7 +165,7 @@ end, {
 --   execsql {
 --     DROP TABLE test2;
 --     CREATE TABLE test2(
---       f1 int default 111, 
+--       f1 int default 111,
 --       f2 real default -4.32,
 --       f3 text default hi,
 --       f4 text default 'abc-123',
@@ -396,8 +396,8 @@ test:do_execsql_test("insert-4.7", [[
   -- } {}
 -- end
 
--- # Test that the special optimization for queries of the form 
--- # "SELECT max(x) FROM tbl" where there is an index on tbl(x) works with 
+-- # Test that the special optimization for queries of the form
+-- # "SELECT max(x) FROM tbl" where there is an index on tbl(x) works with
 -- # INSERT statments.
 -- do_test insert-7.1 {
 --   execsql {
diff --git a/test/sql-tap/insert3.test.lua b/test/sql-tap/insert3.test.lua
index 6e1c2b0e0..5469fe06b 100755
--- a/test/sql-tap/insert3.test.lua
+++ b/test/sql-tap/insert3.test.lua
@@ -182,7 +182,7 @@ test:do_execsql_test(
     "insert3-3.3",
     [[
             CREATE TABLE t4(id INTEGER PRIMARY KEY AUTOINCREMENT, a INT ,b INT ,c INT );
-            CREATE TRIGGER t4r1 AFTER INSERT on t4 FOR EACH ROW 
+            CREATE TRIGGER t4r1 AFTER INSERT on t4 FOR EACH ROW
             WHEN nosuchcol BEGIN
               SELECT 'illegal WHEN clause';
             END;
diff --git a/test/sql-tap/join.test.lua b/test/sql-tap/join.test.lua
index 1fc968307..4175608fd 100755
--- a/test/sql-tap/join.test.lua
+++ b/test/sql-tap/join.test.lua
@@ -324,7 +324,7 @@ test:do_execsql_test(
 test:do_execsql2_test(
     "join-1.13",
     [[
-        SELECT * FROM t1 NATURAL JOIN 
+        SELECT * FROM t1 NATURAL JOIN
           (SELECT b as c, c as d, d as e FROM t2) as t3
     ]], {
         -- <join-1.13>
@@ -564,6 +564,7 @@ test:do_catchsql_test(
         -- </join-3.4.2>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "join-3.5",
     [[
@@ -770,10 +771,10 @@ test:do_execsql_test(
 --     INSERT INTO t9 VALUES(2,22);
 --     CREATE TABLE t10(x INTEGER PRIMARY KEY, y INT);
 --     INSERT INTO t10 VALUES(1,2);
---     INSERT INTO t10 VALUES(3,3);    
+--     INSERT INTO t10 VALUES(3,3);
 --     CREATE TABLE t11(p INTEGER PRIMARY KEY, q INT);
 --     INSERT INTO t11 VALUES(2,111);
---     INSERT INTO t11 VALUES(3,333);    
+--     INSERT INTO t11 VALUES(3,333);
 --     CREATE VIEW v10_11 AS SELECT x, q FROM t10, t11 WHERE t10.y=t11.p;
 --     COMMIT;
 --     SELECT * FROM t9 LEFT JOIN v10_11 ON( a=x );
@@ -825,7 +826,7 @@ test:do_execsql_test(
         COMMIT;
     ]], {
         -- <join-9.1>
-        
+
         -- </join-9.1>
     })
 
@@ -837,7 +838,7 @@ test:do_execsql_test(
         SELECT * FROM t12 NATURAL LEFT JOIN (SELECT * FROM t13 WHERE b>0);
     ]], {
         -- <join-9.1.1>
-        
+
         -- </join-9.1.1>
     })
 
@@ -870,7 +871,7 @@ test:do_execsql_test(
            (SELECT max(m.q) FROM t22 m JOIN t21 n ON n.b=m.p WHERE n.c=1);
     ]], {
         -- <join-10.1>
-        
+
         -- </join-10.1>
     })
 
@@ -965,7 +966,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "join-11.4",
     [[
-        SELECT * FROM t1 NATURAL JOIN t1 
+        SELECT * FROM t1 NATURAL JOIN t1
     ]], {
         -- <join-11.4>
         1, "abc", 2, "def"
@@ -989,7 +990,7 @@ test:do_test(
         ]]
     end, {
         -- <join-11.5>
-        
+
         -- </join-11.5>
     })
 
@@ -1000,7 +1001,7 @@ test:do_test(
 test:do_execsql_test(
     "join-11.7",
     [[
-        SELECT a,b FROM t2 NATURAL JOIN t1 
+        SELECT a,b FROM t2 NATURAL JOIN t1
     ]], {
         -- <join-11.7>
         "one", 1, "two", 2
@@ -1024,14 +1025,14 @@ test:do_test(
         ]]
     end, {
         -- <join-11.8>
-        
+
         -- </join-11.8>
     })
 
 test:do_execsql_test(
     "join-11.9",
     [[
-        SELECT * FROM t1 NATURAL JOIN t2 
+        SELECT * FROM t1 NATURAL JOIN t2
     ]], {
         -- <join-11.9>
         "one", "1", "two", "2"
@@ -1041,7 +1042,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "join-11.10",
     [[
-        SELECT * FROM t2 NATURAL JOIN t1 
+        SELECT * FROM t2 NATURAL JOIN t1
     ]], {
         -- <join-11.10>
         1, "one", 2, "two"
diff --git a/test/sql-tap/join3.test.lua b/test/sql-tap/join3.test.lua
index 4aa8c94a3..f60e9a62e 100755
--- a/test/sql-tap/join3.test.lua
+++ b/test/sql-tap/join3.test.lua
@@ -29,7 +29,7 @@ local bitmask_size = 64
 
 local result = {}
 --for _ in X(0, "X!for", [=[["set N 1","$N<=$bitmask_size","incr N"]]=]) do
-for N=1, bitmask_size do 
+for N=1, bitmask_size do
     table.insert(result,N) -- or result
     test:do_test(
         "join3-1."..N,
@@ -42,7 +42,7 @@ for N=1, bitmask_size do
                 sql = sql .. ", t"..i..""
             end
             return test:execsql(sql)
-        end, 
+        end,
         result
         )
 
diff --git a/test/sql-tap/join6.test.lua b/test/sql-tap/join6.test.lua
index 9ccb8673c..93139dfda 100755
--- a/test/sql-tap/join6.test.lua
+++ b/test/sql-tap/join6.test.lua
@@ -44,7 +44,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "join6-1.2",
     [[
-        SELECT t1.a, t3.b 
+        SELECT t1.a, t3.b
           FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.a=t3.a;
     ]], {
         -- <join6-1.2>
diff --git a/test/sql-tap/keyword1.test.lua b/test/sql-tap/keyword1.test.lua
index 4e5fc5fd8..f9a9c6865 100755
--- a/test/sql-tap/keyword1.test.lua
+++ b/test/sql-tap/keyword1.test.lua
@@ -48,7 +48,7 @@ local kwlist = {
 	"disable"
 }
 
-local bannedkws = { 
+local bannedkws = {
 	"all",
 	"alter",
 	"analyze",
diff --git a/test/sql-tap/limit.test.lua b/test/sql-tap/limit.test.lua
index a1b24ab19..7173df55f 100755
--- a/test/sql-tap/limit.test.lua
+++ b/test/sql-tap/limit.test.lua
@@ -185,7 +185,7 @@ test:do_execsql_test(
         SELECT x FROM t1 ORDER BY x LIMIT 50 OFFSET 50
     ]], {
         -- <limit-1.5>
-        
+
         -- </limit-1.5>
     })
 
@@ -474,7 +474,7 @@ test:do_execsql_test(
         SELECT * FROM t6 LIMIT 0
     ]], {
         -- <limit-6.7>
-        
+
         -- </limit-6.7>
     })
 
@@ -484,7 +484,7 @@ test:do_execsql_test(
         SELECT * FROM t6 LIMIT 0 OFFSET 1
     ]], {
         -- <limit-6.8>
-        
+
         -- </limit-6.8>
     })
 
@@ -570,7 +570,7 @@ test:do_execsql_test(
 -- } {31}
 -- do_test limit-7.12 {
 --   execsql {
---     SELECT a+27 FROM t6 INTERSECT SELECT x FROM t2 
+--     SELECT a+27 FROM t6 INTERSECT SELECT x FROM t2
 --        ORDER BY 1 DESC LIMIT 1 OFFSET 1;
 --   }
 -- } {30}
@@ -631,7 +631,7 @@ test:do_execsql_test(
         INSERT INTO t7 SELECT * FROM t6;
     ]], {
         -- <limit-9.2.1>
-        
+
         -- </limit-9.2.1>
     })
 
@@ -756,7 +756,7 @@ test:do_test(
         ]]
     end, {
         -- <limit-11.1>
-        
+
         -- </limit-11.1>
     })
 
@@ -805,7 +805,7 @@ test:do_catchsql_test(
     })
 
 -- Ticket [db4d96798da8b]
--- LIMIT does not work with nested views containing UNION ALL 
+-- LIMIT does not work with nested views containing UNION ALL
 --
 test:do_test(
     "limit-13.1",
@@ -819,7 +819,7 @@ test:do_test(
         ]]
     end, {
         -- <limit-13.1>
-        
+
         -- </limit-13.1>
     })
 
@@ -1269,7 +1269,7 @@ test:do_test(
         return test:execsql "SELECT z FROM v13c LIMIT 1 OFFSET 8"
     end, {
         -- <limit-13.81>
-        
+
         -- </limit-13.81>
     })
 
@@ -1289,7 +1289,7 @@ test:do_execsql_test(
         SELECT 123 LIMIT 1 OFFSET 1
     ]], {
         -- <limit-14.2>
-        
+
         -- </limit-14.2>
     })
 
@@ -1299,7 +1299,7 @@ test:do_execsql_test(
         SELECT 123 LIMIT 0 OFFSET 0
     ]], {
         -- <limit-14.3>
-        
+
         -- </limit-14.3>
     })
 
@@ -1309,7 +1309,7 @@ test:do_execsql_test(
         SELECT 123 LIMIT 0 OFFSET 1
     ]], {
         -- <limit-14.4>
-        
+
         -- </limit-14.4>
     })
 
diff --git a/test/sql-tap/minmax3.test.lua b/test/sql-tap/minmax3.test.lua
index 90f4f6020..1a7794d99 100755
--- a/test/sql-tap/minmax3.test.lua
+++ b/test/sql-tap/minmax3.test.lua
@@ -299,14 +299,14 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(11, 3, 3);
     ]], {
         -- <minmax3-2.1>
-        
+
         -- </minmax3-2.1>
     })
 
 test:do_execsql_test(
     "minmax3-2.2",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1; 
+        SELECT min(b) FROM t2 WHERE a = 1;
     ]], {
         -- <minmax3-2.2>
         1
@@ -316,7 +316,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.3",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b>1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b>1;
     ]], {
         -- <minmax3-2.3>
         2
@@ -326,7 +326,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.4",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b>-1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b>-1;
     ]], {
         -- <minmax3-2.4>
         1
@@ -336,7 +336,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.5",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1; 
+        SELECT min(b) FROM t2 WHERE a = 1;
     ]], {
         -- <minmax3-2.5>
         1
@@ -346,7 +346,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.6",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b<2; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b<2;
     ]], {
         -- <minmax3-2.6>
         1
@@ -356,7 +356,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.7",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b<1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b<1;
     ]], {
         -- <minmax3-2.7>
         ""
@@ -366,7 +366,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.8",
     [[
-        SELECT min(b) FROM t2 WHERE a = 3 AND b<1; 
+        SELECT min(b) FROM t2 WHERE a = 3 AND b<1;
     ]], {
         -- <minmax3-2.8>
         ""
@@ -392,14 +392,14 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(11, 3, 3);
     ]], {
         -- <minmax3-3.1>
-        
+
         -- </minmax3-3.1>
     })
 
 test:do_execsql_test(
     "minmax3-3.2",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1; 
+        SELECT min(b) FROM t2 WHERE a = 1;
     ]], {
         -- <minmax3-3.2>
         1
@@ -409,7 +409,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.3",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b>1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b>1;
     ]], {
         -- <minmax3-3.3>
         2
@@ -419,7 +419,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.4",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b>-1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b>-1;
     ]], {
         -- <minmax3-3.4>
         1
@@ -429,7 +429,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.5",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1; 
+        SELECT min(b) FROM t2 WHERE a = 1;
     ]], {
         -- <minmax3-3.5>
         1
@@ -439,7 +439,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.6",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b<2; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b<2;
     ]], {
         -- <minmax3-3.6>
         1
@@ -449,7 +449,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.7",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b<1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b<1;
     ]], {
         -- <minmax3-3.7>
         ""
@@ -459,7 +459,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.8",
     [[
-        SELECT min(b) FROM t2 WHERE a = 3 AND b<1; 
+        SELECT min(b) FROM t2 WHERE a = 3 AND b<1;
     ]], {
         -- <minmax3-3.8>
         ""
diff --git a/test/sql-tap/minmax4.test.lua b/test/sql-tap/minmax4.test.lua
index 1674a7753..3a71462e0 100755
--- a/test/sql-tap/minmax4.test.lua
+++ b/test/sql-tap/minmax4.test.lua
@@ -14,11 +14,11 @@ test:plan(21)
 --
 -------------------------------------------------------------------------
 --
--- Test for queries of the form:  
+-- Test for queries of the form:
 --
 --    SELECT p, max(q) FROM t1;
 --
--- Demonstration that the value returned for p is on the same row as 
+-- Demonstration that the value returned for p is on the same row as
 -- the maximum q.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
index b1c4f026b..175ad5b92 100755
--- a/test/sql-tap/misc1.test.lua
+++ b/test/sql-tap/misc1.test.lua
@@ -226,7 +226,7 @@ test:do_test(
         return test.lindex(r, 1)
     end, {
         -- <misc1-3.1>
-        
+
         -- </misc1-3.1>
     })
 
@@ -766,7 +766,7 @@ test:do_execsql_test(
 end
 
 -- There was a problem with realloc() in the OP_MemStore operation of
--- the VDBE.  A buffer was being reallocated but some pointers into 
+-- the VDBE.  A buffer was being reallocated but some pointers into
 -- the old copy of the buffer were not being moved over to the new copy.
 -- The following code tests for the problem.
 --
@@ -946,7 +946,7 @@ if (0 > 0) then
             CREATE TABLE RealTable(TestID INTEGER PRIMARY KEY, TestString TEXT);
             CREATE TABLE TempTable(TestID INTEGER PRIMARY KEY, TestString TEXT);
             CREATE TRIGGER trigTest_1 AFTER UPDATE ON TempTable BEGIN
-              INSERT INTO RealTable(TestString) 
+              INSERT INTO RealTable(TestString)
                  SELECT new.TestString FROM TempTable LIMIT 1;
             END;
             INSERT INTO TempTable(TestString) VALUES ('1');
@@ -1078,7 +1078,7 @@ test:do_catchsql_test(
 --   ROLLBACK;
 --   DROP TABLE IF EXISTS t;
 -- } {0 {}}
--- # At one point, running this would read one byte passed the end of a 
+-- # At one point, running this would read one byte passed the end of a
 -- # buffer, upsetting valgrind.
 -- #
 -- do_test misc1-24.0 {
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 62678bbbd..70c605ef8 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -21,7 +21,7 @@ test:plan(31)
 -- $Id: misc5.test,v 1.22 2008/07/29 10:26:45 danielk1977 Exp $
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
--- Build records using the MakeRecord opcode such that the size of the 
+-- Build records using the MakeRecord opcode such that the size of the
 -- header is at the transition point in the size of a varint.
 --
 -- This test causes an assertion failure or a buffer overrun in version
@@ -44,7 +44,7 @@ for i = 120, 140 - 1, 1 do
             sql2 = sql2 .. ");"
             return test:execsql(string.format("%s%s", sql1, sql2))
         end, {
-            
+
         })
 
 end
@@ -160,33 +160,33 @@ test:do_execsql_test(
         INSERT INTO songs VALUES(4,'three',5);
         INSERT INTO songs VALUES(5,'one',7);
         INSERT INTO songs VALUES(6,'two',11);
-        SELECT DISTINCT artist 
-        FROM (    
-         SELECT DISTINCT artist    
-         FROM songs      
-         WHERE songid IN (    
-          SELECT songid    
-          FROM songs    
+        SELECT DISTINCT artist
+        FROM (
+         SELECT DISTINCT artist
+         FROM songs
+         WHERE songid IN (
+          SELECT songid
+          FROM songs
           WHERE LOWER(artist) IN (
-            SELECT DISTINCT LOWER(artist)    
-            FROM (      
+            SELECT DISTINCT LOWER(artist)
+            FROM (
               -- This sub-query returns the table:
               --
               --     two      14
               --     one      10
               --     three    5
               --
-              SELECT DISTINCT artist,sum(timesplayed) AS total      
-              FROM songs      
-              GROUP BY LOWER(artist)      
-              ORDER BY total DESC      
-              LIMIT 10    
-            )    
+              SELECT DISTINCT artist,sum(timesplayed) AS total
+              FROM songs
+              GROUP BY LOWER(artist)
+              ORDER BY total DESC
+              LIMIT 10
+            )
             WHERE artist <> ''
           )
          )
          LIMIT 1
-        )  
+        )
         ORDER BY LOWER(artist) ASC;
     ]], {
         -- <misc5-3.1>
@@ -217,7 +217,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.1",
     [[
-        SELECT .1 
+        SELECT .1
     ]], {
         -- <misc5-5.1>
         0.1
@@ -227,7 +227,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.2",
     [[
-        SELECT 2. 
+        SELECT 2.
     ]], {
         -- <misc5-5.2>
         2.0
@@ -237,7 +237,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.3",
     [[
-        SELECT 3.e0 
+        SELECT 3.e0
     ]], {
         -- <misc5-5.3>
         3.0
@@ -264,7 +264,7 @@ test:drop_all_tables()
 -- do_test misc5-6.1 {
 --   catchsql {
 --     SELECT * FROM sql_master
---     UNION ALL 
+--     UNION ALL
 --     SELECT * FROM sql_master
 --     LIMIT (SELECT count(*) FROM blah);
 --   }
@@ -274,9 +274,9 @@ test:drop_all_tables()
 --     CREATE TABLE logs(msg TEXT, timestamp INTEGER, dbtime TEXT);
 --   }
 --   catchsql {
---     SELECT * FROM logs WHERE logs.oid >= (SELECT head FROM logs_base) 
---     UNION ALL 
---     SELECT * FROM logs 
+--     SELECT * FROM logs WHERE logs.oid >= (SELECT head FROM logs_base)
+--     UNION ALL
+--     SELECT * FROM logs
 --     LIMIT (SELECT lmt FROM logs_base) ;
 --   }
 -- } {1 {no such table: logs_base}}
@@ -993,7 +993,7 @@ test:do_test(
             SELECT x FROM t3 ORDER BY x;
         ]]
     end, {
-        -- <misc5-11.1> 
+        -- <misc5-11.1>
     -9223372036854775808LL, -9223372036854775807LL, -9223372036854775806LL, -4611686018427387906LL,
  -4611686018427387905LL, -4611686018427387904LL, -4611686018427387903LL, -4611686018427387902LL,
  -2305843009213693954LL, -2305843009213693953LL, -2305843009213693952LL, -2305843009213693951LL,
diff --git a/test/sql-tap/null.test.lua b/test/sql-tap/null.test.lua
index a1f33f5ad..ca20e3558 100755
--- a/test/sql-tap/null.test.lua
+++ b/test/sql-tap/null.test.lua
@@ -153,7 +153,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "null-3.1",
     [[
-        select count(*), count(b), count(c), sum(b), sum(c), 
+        select count(*), count(b), count(c), sum(b), sum(c),
                avg(b), avg(c), min(b), max(b) from t1;
     ]], {
         -- <null-3.1>
@@ -353,7 +353,7 @@ test:do_execsql_test(
         SELECT x FROM t4 WHERE y=NULL;
     ]], {
         -- <null-8.1>
-        
+
         -- </null-8.1>
     })
 
@@ -363,7 +363,7 @@ test:do_execsql_test(
         SELECT x FROM t4 WHERE y IN (33,NULL);
     ]], {
         -- <null-8.2>
-        
+
         -- </null-8.2>
     })
 
@@ -406,7 +406,7 @@ test:do_execsql_test(
         SELECT x FROM t4 WHERE y=NULL;
     ]], {
         -- <null-8.11>
-        
+
         -- </null-8.11>
     })
 
@@ -416,7 +416,7 @@ test:do_execsql_test(
         SELECT x FROM t4 WHERE y IN (33,NULL);
     ]], {
         -- <null-8.12>
-        
+
         -- </null-8.12>
     })
 
diff --git a/test/sql-tap/offset1.test.lua b/test/sql-tap/offset1.test.lua
index 194c3a735..fe4ca1940 100755
--- a/test/sql-tap/offset1.test.lua
+++ b/test/sql-tap/offset1.test.lua
@@ -13,7 +13,7 @@ test:plan(22)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- This file implements test cases for the [b65cb2c8d91f6685841d7d1e13b6]
 -- bug:  Correct handling of LIMIT and OFFSET on a UNION ALL query where
 -- the right-hand SELECT contains an ORDER BY in a subquery.
@@ -162,7 +162,7 @@ test:do_execsql_test(
         LIMIT 3 OFFSET 9;
     ]], {
         -- <offset1-1.2.9>
-        
+
         -- </offset1-1.2.9>
     })
 
@@ -172,7 +172,7 @@ test:do_execsql_test(
         SELECT * FROM t1 LIMIT 0;
     ]], {
         -- <offset1-1.3.0>
-        
+
         -- </offset1-1.3.0>
     })
 
@@ -185,7 +185,7 @@ test:do_execsql_test(
         LIMIT 0 OFFSET 1;
     ]], {
         -- <offset1-1.4.0>
-        
+
         -- </offset1-1.4.0>
     })
 
diff --git a/test/sql-tap/orderby1.test.lua b/test/sql-tap/orderby1.test.lua
index f2b0fa06e..33f437670 100755
--- a/test/sql-tap/orderby1.test.lua
+++ b/test/sql-tap/orderby1.test.lua
@@ -53,7 +53,7 @@ test:do_test(
         ]]
     end, {
         -- <1.0>
-        
+
         -- </1.0>
     })
 
@@ -271,7 +271,7 @@ test:do_test(
         -- </1.6c>
     })
 
--- ORDER BY 
+-- ORDER BY
 -- # Reconstruct the test data to use indices rather than integer primary keys.
 -- #
 -- do_test 2.0 {
@@ -440,7 +440,7 @@ test:do_test(
         ]]
     end, {
         -- <3.0>
-        
+
         -- </3.0>
     })
 
@@ -687,7 +687,7 @@ test:do_execsql_test(
         EXPLAIN QUERY PLAN SELECT 5 ORDER BY 1
     ]], {
         -- <5.0>
-        
+
         -- </5.0>
     })
 
@@ -733,7 +733,7 @@ test:do_execsql_test(
         INSERT INTO abc VALUES(4, 5, 6);
         INSERT INTO abc VALUES(7, 8, 9);
         SELECT (
-          SELECT 'hardware' FROM ( 
+          SELECT 'hardware' FROM (
             SELECT 'software' ORDER BY 'firmware' ASC, 'sportswear' DESC
           ) GROUP BY 1 HAVING length(b) <> 0
         )
diff --git a/test/sql-tap/orderby6.test.lua b/test/sql-tap/orderby6.test.lua
index 8d4a0507b..ab6f36dc9 100755
--- a/test/sql-tap/orderby6.test.lua
+++ b/test/sql-tap/orderby6.test.lua
@@ -47,7 +47,7 @@ test:plan(34)
                 INSERT INTO t1 SELECT x, x%40, x/40 FROM cnt;
             ]]
         end, {
-            
+
         })
 
     -- Run various ORDER BY queries that can benefit from block-sort.
@@ -55,10 +55,10 @@ test:plan(34)
     -- by adding + to each term of the ORDER BY clause.
     --
     test:do_execsql_test(
-        "1.2", 
+        "1.2",
         [[
             SELECT b,a,c FROM t1 ORDER BY b,a,c;
-        ]], 
+        ]],
         test:execsql "SELECT b,a,c FROM t1 ORDER BY +b,+a,+c"
         )
 
@@ -66,7 +66,7 @@ test:plan(34)
         "1.3",
         [[
             SELECT b,a,c FROM t1 ORDER BY b,c DESC,a;
-        ]], 
+        ]],
         test:execsql "SELECT b,a,c FROM t1 ORDER BY +b,+c DESC,+a"
         )
 
@@ -74,7 +74,7 @@ test:plan(34)
         "1.4",
         [[
             SELECT b,a,c FROM t1 ORDER BY b DESC,c,a;
-        ]], 
+        ]],
         test:execsql "SELECT b,a,c FROM t1 ORDER BY +b DESC,+c,+a"
         )
 
@@ -82,7 +82,7 @@ test:plan(34)
         "1.5",
         [[
             SELECT b,a,c FROM t1 ORDER BY b DESC,a,c;
-        ]], 
+        ]],
         test:execsql "SELECT b,a,c FROM t1 ORDER BY +b DESC,+a,+c"
         )
 
@@ -228,14 +228,14 @@ test:plan(34)
                                 FROM cnt;
             ]]
         end, {
-            
+
         })
 
     test:do_execsql_test(
         "1.32",
         [[
             SELECT a FROM t2 ORDER BY b,c,d,e,f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f;"
         )
 
@@ -243,7 +243,7 @@ test:plan(34)
         "1.33",
         [[
             SELECT a FROM t2 ORDER BY b,c,d,e,+f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f;"
         )
 
@@ -251,7 +251,7 @@ test:plan(34)
         "1.34",
         [[
             SELECT a FROM t2 ORDER BY b,c,d,+e,+f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f;"
         )
 
@@ -259,7 +259,7 @@ test:plan(34)
         "1.35",
         [[
             SELECT a FROM t2 ORDER BY b,c,+d,+e,+f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f;"
         )
 
@@ -267,7 +267,7 @@ test:plan(34)
         "1.36",
         [[
             SELECT a FROM t2 ORDER BY b,+c,+d,+e,+f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f;"
         )
 
@@ -275,7 +275,7 @@ test:plan(34)
         "1.37",
         [[
             SELECT a FROM t2 ORDER BY b,c,d,e,f DESC;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f DESC;"
         )
 
@@ -283,7 +283,7 @@ test:plan(34)
         "1.38",
         [[
             SELECT a FROM t2 ORDER BY b,c,d,e DESC,f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e DESC,+f;"
         )
 
@@ -291,7 +291,7 @@ test:plan(34)
         "1.39",
         [[
             SELECT a FROM t2 ORDER BY b,c,d DESC,e,f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d DESC,+e,+f;"
         )
 
@@ -299,7 +299,7 @@ test:plan(34)
         "1.40",
         [[
             SELECT a FROM t2 ORDER BY b,c DESC,d,e,f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c DESC,+d,+e,+f;"
         )
 
@@ -307,7 +307,7 @@ test:plan(34)
         "1.41",
         [[
             SELECT a FROM t2 ORDER BY b DESC,c,d,e,f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b DESC,+c,+d,+e,+f;"
         )
     -- Tests are commented because of the reason described in
diff --git a/test/sql-tap/orderby9.test.lua b/test/sql-tap/orderby9.test.lua
index 6957ed098..96872dbd3 100755
--- a/test/sql-tap/orderby9.test.lua
+++ b/test/sql-tap/orderby9.test.lua
@@ -14,7 +14,7 @@ test:plan(4)
 --
 -------------------------------------------------------------------------
 -- This file implements regression tests for sql library.
--- 
+--
 -- This file seeks to verify that expressions (and especially functions)
 -- that are in both the ORDER BY clause and the result set are only
 -- evaluated once.
@@ -36,7 +36,7 @@ test:do_test(
     1.0,
     function()
         -- If random() is only evaluated once and then reused for each row, then
-        -- the output should appear in sorted order.  If random() is evaluated 
+        -- the output should appear in sorted order.  If random() is evaluated
         -- separately for the result set and the ORDER BY clause, then the output
         -- order will be random.
         local l1 = test:execsql("SELECT random() AS y FROM t1 ORDER BY 1;")
diff --git a/test/sql-tap/resolver01.test.lua b/test/sql-tap/resolver01.test.lua
index 66db0f004..1ab1116cb 100755
--- a/test/sql-tap/resolver01.test.lua
+++ b/test/sql-tap/resolver01.test.lua
@@ -314,17 +314,17 @@ test:do_execsql_test(
         SELECT min(name) FROM t61 GROUP BY lower(name);
     ]], {
         -- <resolver01-6.1>
-        
+
         -- </resolver01-6.1>
     })
 
 test:do_execsql_test(
     "resolver01-6.2",
     [[
-        SELECT min(name) AS name FROM t61 GROUP BY lower(name); 
+        SELECT min(name) AS name FROM t61 GROUP BY lower(name);
     ]], {
         -- <resolver01-6.2>
-        
+
         -- </resolver01-6.2>
     })
 
@@ -360,7 +360,7 @@ test:do_execsql_test(
         SELECT 2 AS x WHERE (SELECT x AS y WHERE 1>y);
     ]], {
         -- <resolver01-7.2>
-        
+
         -- </resolver01-7.2>
     })
 
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index 2f61ae0ec..b812c5565 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -351,7 +351,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT LEAST(f1,f2) FROM test1"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-2.8>
@@ -416,7 +416,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT GREATEST(f1,f2) FROM test1"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-2.11>
@@ -431,7 +431,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT GREATEST(f1,f2)+1 FROM test1"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-2.12>
@@ -623,7 +623,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT f1 FROM test1 WHERE f1>=11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-3.4>
@@ -638,7 +638,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT f1 FROM test1 WHERE f1>11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-3.5>
@@ -653,7 +653,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT f1 FROM test1 WHERE f1!=11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-3.6>
@@ -668,7 +668,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT f1 FROM test1 WHERE LEAST(f1,f2)!=11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-3.7>
@@ -683,7 +683,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT f1 FROM test1 WHERE GREATEST(f1,f2)!=11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-3.8>
@@ -957,7 +957,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql2 "SELECT DISTINCT * FROM test1 WHERE f1==11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         set_full_column_names(false)
         return table.insert(v,msg) or v
     end, {
@@ -1065,7 +1065,7 @@ test:do_test(
 
 test:do_catchsql2_test(
     "select1-6.6",
-    [[SELECT test1.f1+F2, t1 FROM test1, test2 
+    [[SELECT test1.f1+F2, t1 FROM test1, test2
          ORDER BY f2]], {
         -- <select1-6.6>
         0, {"COLUMN_1",33,"T1","abc","COLUMN_1",77,"T1","abc"}
@@ -1074,7 +1074,7 @@ test:do_catchsql2_test(
 
 test:do_catchsql2_test(
     "select1-6.7",
-    [[SELECT A.f1, t1 FROM test1 as A, test2 
+    [[SELECT A.f1, t1 FROM test1 as A, test2
          ORDER BY f2]], {
         -- <select1-6.7>
         0, {"F1", 11, "T1", "abc", "F1", 33, "T1", "abc"}
@@ -1083,7 +1083,7 @@ test:do_catchsql2_test(
 
 test:do_catchsql2_test(
     "select1-6.8",
-    [[SELECT A.f1, f1 FROM test1 as A, test1 as B 
+    [[SELECT A.f1, f1 FROM test1 as A, test1 as B
          ORDER BY f2]], {
         -- <select1-6.8>
         1, "ambiguous column name: F1"
@@ -1092,7 +1092,7 @@ test:do_catchsql2_test(
 
 test:do_catchsql2_test(
     "select1-6.8b",
-    [[SELECT A.f1, B.f1 FROM test1 as A, test1 as B 
+    [[SELECT A.f1, B.f1 FROM test1 as A, test1 as B
          ORDER BY f2]], {
         -- <select1-6.8b>
         1, "ambiguous column name: F2"
@@ -1101,7 +1101,7 @@ test:do_catchsql2_test(
 
 test:do_catchsql2_test(
     "select1-6.8c",
-    [[SELECT A.f1, f1 FROM test1 as A, test1 as A 
+    [[SELECT A.f1, f1 FROM test1 as A, test1 as A
          ORDER BY f2]], {
         -- <select1-6.8c>
         1, "ambiguous column name: A.F1"
@@ -1110,7 +1110,7 @@ test:do_catchsql2_test(
 
 test:do_catchsql_test(
     "select1-6.9.1",
-    [[SELECT A.f1, B.f1 FROM test1 as A, test1 as B 
+    [[SELECT A.f1, B.f1 FROM test1 as A, test1 as B
          ORDER BY A.f1, B.f1]], {
         -- <select1-6.9.1>
         0, {11, 11, 11, 33, 33, 11, 33, 33}
@@ -1334,7 +1334,7 @@ test:do_catchsql2_test(
                 INSERT INTO t6 VALUES('b','1');
                 INSERT INTO t6 VALUES('c','2');
                 INSERT INTO t6 VALUES('d','3');
-                SELECT a FROM t6 WHERE b IN 
+                SELECT a FROM t6 WHERE b IN
                    (SELECT b FROM t6 WHERE a<='b' UNION SELECT '3' AS x
                             ORDER BY 1 LIMIT 1)
             ]], {
@@ -1346,7 +1346,7 @@ test:do_catchsql2_test(
         test:do_execsql_test(
             "select1-6.21",
             [[
-                SELECT a FROM t6 WHERE b IN 
+                SELECT a FROM t6 WHERE b IN
                    (SELECT b FROM t6 WHERE a<='b' UNION SELECT '3' AS x
                             ORDER BY 1 DESC LIMIT 1)
             ]], {
@@ -1358,7 +1358,7 @@ test:do_catchsql2_test(
         test:do_execsql_test(
             "select1-6.22",
             [[
-                SELECT a FROM t6 WHERE b IN 
+                SELECT a FROM t6 WHERE b IN
                    (SELECT b FROM t6 WHERE a<='b' UNION SELECT '3' AS x
                             ORDER BY b LIMIT 2)
                 ORDER BY a;
@@ -1371,7 +1371,7 @@ test:do_catchsql2_test(
         test:do_catchsql_test(
             "select1-6.23",
             [[
-                SELECT a FROM t6 WHERE b IN 
+                SELECT a FROM t6 WHERE b IN
                    (SELECT b FROM t6 WHERE a<='b' UNION SELECT '3' AS x
                             ORDER BY x DESC LIMIT 2)
                 ORDER BY a;
@@ -1887,7 +1887,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES(0,'1','2');
     ]], {
         -- <select1-12.4>
-        
+
         -- </select1-12.4>
     })
 
@@ -1911,7 +1911,7 @@ test:do_execsql_test(
             -- </select1-12.6>
         })
 
-    -- 
+    --
 
 
 -- ifcapable compound
@@ -2001,7 +2001,7 @@ test:do_test(
 -- db close
 -- sql db test.db
 -- do_test select1-14.1 {
---   execsql { 
+--   execsql {
 --     SELECT * FROM sql_master WHERE rowid>10;
 --     SELECT * FROM sql_master WHERE rowid=10;
 --     SELECT * FROM sql_master WHERE rowid<10;
@@ -2011,7 +2011,7 @@ test:do_test(
 --   }
 -- } {}
 -- do_test select1-14.2 {
---   execsql { 
+--   execsql {
 --     SELECT 10 IN (SELECT rowid FROM sql_master);
 --   }
 -- } {0}
@@ -2034,7 +2034,7 @@ test:do_test(
             INSERT INTO t1 VALUES(3, 3);
         ]], {
             -- <select1-15.1>
-            
+
             -- </select1-15.1>
         })
 
@@ -2046,7 +2046,7 @@ test:do_test(
     test:do_execsql_test(
         "select1-15.3",
         [[
-            SELECT 2 IN (SELECT a FROM t1) 
+            SELECT 2 IN (SELECT a FROM t1)
         ]], {
             -- <select1-15.3>
             true
diff --git a/test/sql-tap/select3.test.lua b/test/sql-tap/select3.test.lua
index 258ac8000..ffba58ec2 100755
--- a/test/sql-tap/select3.test.lua
+++ b/test/sql-tap/select3.test.lua
@@ -215,9 +215,9 @@ test:do_execsql_test("select3-4.1", [[
 })
 
 test:do_execsql_test("select3-4.2", [[
-  SELECT log, count(*) FROM t1 
-  GROUP BY log 
-  HAVING count(*)>=4 
+  SELECT log, count(*) FROM t1
+  GROUP BY log
+  HAVING count(*)>=4
   ORDER BY log
 ]], {
   -- <select3-4.2>
@@ -226,9 +226,9 @@ test:do_execsql_test("select3-4.2", [[
 })
 
 test:do_execsql_test("select3-4.3", [[
-  SELECT log, count(*) FROM t1 
-  GROUP BY log 
-  HAVING count(*)>=4 
+  SELECT log, count(*) FROM t1
+  GROUP BY log
+  HAVING count(*)>=4
   ORDER BY max(n)+0
 ]], {
   -- <select3-4.3>
@@ -237,9 +237,9 @@ test:do_execsql_test("select3-4.3", [[
 })
 
 test:do_execsql_test("select3-4.4", [[
-  SELECT log AS x, count(*) AS y FROM t1 
+  SELECT log AS x, count(*) AS y FROM t1
   GROUP BY x
-  HAVING y>=4 
+  HAVING y>=4
   ORDER BY max(n)+0
 ]], {
   -- <select3-4.4>
@@ -248,9 +248,9 @@ test:do_execsql_test("select3-4.4", [[
 })
 
 test:do_execsql_test("select3-4.5", [[
-  SELECT log AS x FROM t1 
+  SELECT log AS x FROM t1
   GROUP BY x
-  HAVING count(*)>=4 
+  HAVING count(*)>=4
   ORDER BY max(n)+0
 ]], {
   -- <select3-4.5>
@@ -259,8 +259,8 @@ test:do_execsql_test("select3-4.5", [[
 })
 
 test:do_execsql_test("select3-5.1", [[
-  SELECT log, count(*), avg(n), max(n+log*2) FROM t1 
-  GROUP BY log 
+  SELECT log, count(*), avg(n), max(n+log*2) FROM t1
+  GROUP BY log
   ORDER BY max(n+log*2)+0, avg(n)+0
 ]], {
   -- <select3-5.1>
@@ -269,8 +269,8 @@ test:do_execsql_test("select3-5.1", [[
 })
 
 test:do_execsql_test("select3-5.2", [[
-  SELECT log, count(*), avg(n), max(n+log*2) FROM t1 
-  GROUP BY log 
+  SELECT log, count(*), avg(n), max(n+log*2) FROM t1
+  GROUP BY log
   ORDER BY max(n+log*2)+0, GREATEST(log,avg(n))+0
 ]], {
   -- <select3-5.2>
@@ -355,7 +355,7 @@ test:do_execsql_test("select3-7.1", [[
   SELECT a, sum(b) FROM t2 WHERE b=5 GROUP BY a;
 ]], {
   -- <select3-7.1>
-  
+
   -- </select3-7.1>
 })
 
diff --git a/test/sql-tap/select4.test.lua b/test/sql-tap/select4.test.lua
index e2b13090d..465800940 100755
--- a/test/sql-tap/select4.test.lua
+++ b/test/sql-tap/select4.test.lua
@@ -125,7 +125,7 @@ test:do_execsql_test(
 
 -- do_test select4-1.1g {
 --   execsql {
---     CREATE TABLE t2 AS 
+--     CREATE TABLE t2 AS
 --       SELECT DISTINCT log FROM t1
 --       UNION ALL
 --       SELECT n FROM t1 WHERE log=2;
@@ -136,7 +136,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select4-1.2",
     [[
-        SELECT log FROM t1 WHERE n IN 
+        SELECT log FROM t1 WHERE n IN
           (SELECT DISTINCT log FROM t1 UNION ALL
            SELECT n FROM t1 WHERE log=3)
         ORDER BY log;
@@ -193,7 +193,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select4-2.2",
     [[
-        SELECT log FROM t1 WHERE n IN 
+        SELECT log FROM t1 WHERE n IN
           (SELECT DISTINCT log FROM t1 UNION
            SELECT n FROM t1 WHERE log=3)
         ORDER BY log;
@@ -255,7 +255,7 @@ test:do_execsql_test(
 
 -- do_test select4-3.1.2 {
 --   execsql {
---     CREATE TABLE t2 AS 
+--     CREATE TABLE t2 AS
 --       SELECT DISTINCT log FROM t1
 --       EXCEPT
 --       SELECT n FROM t1 WHERE log=3
@@ -266,7 +266,7 @@ test:do_execsql_test(
 -- execsql {DROP TABLE t2}
 -- do_test select4-3.1.3 {
 --   execsql {
---     CREATE TABLE t2 AS 
+--     CREATE TABLE t2 AS
 --       SELECT DISTINCT log FROM t1
 --       EXCEPT
 --       SELECT n FROM t1 WHERE log=3
@@ -278,7 +278,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select4-3.2",
     [[
-        SELECT log FROM t1 WHERE n IN 
+        SELECT log FROM t1 WHERE n IN
           (SELECT DISTINCT log FROM t1 EXCEPT
            SELECT n FROM t1 WHERE log=3)
         ORDER BY log;
@@ -358,7 +358,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select4-4.2",
     [[
-        SELECT log FROM t1 WHERE n IN 
+        SELECT log FROM t1 WHERE n IN
           (SELECT DISTINCT log FROM t1 INTERSECT
            SELECT n FROM t1 WHERE log=3)
         ORDER BY log;
@@ -390,7 +390,7 @@ test:do_catchsql_test(
           SELECT 0 ORDER BY 1
           INTERSECT
           SELECT 1
-          INTERSECT 
+          INTERSECT
           SELECT 2
           ORDER BY 1
         );
@@ -699,7 +699,7 @@ test:do_execsql_test(
         SELECT NULL EXCEPT SELECT NULL
     ]], {
         -- <select4-6.7>
-        
+
         -- </select4-6.7>
     })
 
@@ -714,7 +714,7 @@ INSERT INTO t2 VALUES (0, 1), (1, 1), (2, 2), (3, 4), (4, 8), (5, 15);]]
 --     CREATE TABLE t2 AS SELECT log AS 'x', count INT (*) AS 'y' FROM t1 GROUP BY log;
 --     SELECT * FROM t2 ORDER BY x;
 --   }
--- } {0 1 1 1 2 2 3 4 4 8 5 15}  
+-- } {0 1 1 1 2 2 3 4 4 8 5 15}
 test:do_execsql2_test(
     "select4-7.2",
     [[
@@ -911,7 +911,7 @@ test:do_execsql2_test(
          WHERE b=3
     ]], {
         -- <select4-9.9.2>
-        
+
         -- </select4-9.9.2>
     })
 
@@ -980,7 +980,7 @@ test:do_execsql_test(
         SELECT DISTINCT log FROM t1 ORDER BY log LIMIT 0
     ]], {
         -- <select4-10.3>
-        
+
         -- </select4-10.3>
     })
 
@@ -1038,7 +1038,7 @@ test:do_execsql_test(
         SELECT DISTINCT log FROM t1 ORDER BY +log LIMIT 3 OFFSET 20
     ]], {
         -- <select4-10.7>
-        
+
         -- </select4-10.7>
     })
 
@@ -1048,7 +1048,7 @@ test:do_execsql_test(
         SELECT DISTINCT log FROM t1 ORDER BY log LIMIT 0 OFFSET 3
     ]], {
         -- <select4-10.8>
-        
+
         -- </select4-10.8>
     })
 
@@ -1372,7 +1372,7 @@ test:do_execsql_test(
         SELECT * FROM t14 EXCEPT VALUES(1,2,3) EXCEPT VALUES(4,5,6)
     ]], {
         -- <select4-14.7>
-        
+
         -- </select4-14.7>
     })
 
diff --git a/test/sql-tap/select5.test.lua b/test/sql-tap/select5.test.lua
index 2902def37..5882102c9 100755
--- a/test/sql-tap/select5.test.lua
+++ b/test/sql-tap/select5.test.lua
@@ -198,7 +198,7 @@ test:do_execsql_test(
 
 -- Some tests for queries with a GROUP BY clause but no aggregate functions.
 --
--- Note: The query in test cases 5.1 through 5.5 are not legal SQL. So if the 
+-- Note: The query in test cases 5.1 through 5.5 are not legal SQL. So if the
 -- implementation changes in the future and it returns different results,
 -- this is not such a big deal.
 --
@@ -213,7 +213,7 @@ test:do_execsql_test(
         CREATE INDEX t2_idx ON t2(a);
     ]], {
         -- <select5-5.1>
-        
+
         -- </select5-5.1>
     })
 
@@ -384,7 +384,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select5-8.6",
     [[
-        SELECT a, count(t8a.b) FROM t8a, t8b WHERE b=t8b.rowid 
+        SELECT a, count(t8a.b) FROM t8a, t8b WHERE b=t8b.rowid
          GROUP BY a ORDER BY 2;
     ]], {
         -- <select5-8.6>
diff --git a/test/sql-tap/select6.test.lua b/test/sql-tap/select6.test.lua
index 82505f034..8ad91390a 100755
--- a/test/sql-tap/select6.test.lua
+++ b/test/sql-tap/select6.test.lua
@@ -354,7 +354,7 @@ test:do_execsql_test(
         WHERE a<10
     ]], {
         -- <select6-3.7>
-        
+
         -- </select6-3.7>
     })
 
@@ -376,7 +376,7 @@ test:do_execsql_test(
         WHERE a<10
     ]], {
         -- <select6-3.9>
-        
+
         -- </select6-3.9>
     })
 
@@ -394,7 +394,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select6-3.11",
     [[
-        SELECT a,b,a+b FROM 
+        SELECT a,b,a+b FROM
            (SELECT avg(x) as a, y as b FROM t1 GROUP BY b)
         WHERE b<4 ORDER BY a
     ]], {
@@ -406,7 +406,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select6-3.12",
     [[
-        SELECT a,b,a+b FROM 
+        SELECT a,b,a+b FROM
            (SELECT avg(x) as a, y as b FROM t1 GROUP BY b HAVING a>1)
         WHERE b<4 ORDER BY a
     ]], {
@@ -418,7 +418,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select6-3.13",
     [[
-        SELECT a,b,a+b FROM 
+        SELECT a,b,a+b FROM
            (SELECT avg(x) as a, y as b FROM t1 GROUP BY b HAVING a>1)
         ORDER BY a
     ]], {
@@ -452,7 +452,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select6-4.1",
     [[
-        SELECT a,b,c FROM 
+        SELECT a,b,c FROM
           (SELECT x AS a, y AS b, x+y AS c FROM t1 WHERE y=4)
         WHERE a<10 ORDER BY a;
     ]], {
@@ -633,7 +633,7 @@ test:do_execsql_test(
         SELECT c,b,a,* FROM (SELECT 1 AS a, 2 AS b, 'abc' AS c WHERE false)
     ]], {
         -- <select6-7.3>
-        
+
         -- </select6-7.3>
     })
 
@@ -704,7 +704,7 @@ test:do_execsql_test(
         -- </select6-8.2>
     })
 
--- If view support is omitted from the build, then so is the query 
+-- If view support is omitted from the build, then so is the query
 -- "flattener". So omit this test and test select6-8.6 in that case.
 test:do_test(
     "select6-8.3",
@@ -740,7 +740,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select6-8.5",
     [[
-        SELECT * FROM 
+        SELECT * FROM
           (SELECT y, p, q, r FROM
              (SELECT t1.y AS y, t2.b AS b FROM t1, t2 WHERE t1.x=t2.a) AS m,
              (SELECT t3.p AS p, t3.q AS q, t4.r AS r FROM t3 NATURAL JOIN t4) as n
@@ -757,7 +757,7 @@ test:do_test(
     "select6-8.6",
     function()
         return is_flat([[
-    SELECT * FROM 
+    SELECT * FROM
       (SELECT y, p, q, r FROM
          (SELECT t1.y AS y, t2.b AS b FROM t1, t2 WHERE t1.x=t2.a) AS m,
          (SELECT t3.p AS p, t3.q AS q, t4.r AS r FROM t3 NATURAL JOIN t4) as n
@@ -889,7 +889,7 @@ test:do_execsql_test(
 
 ---------------------------------------------------------------------------
 -- Test that if a UNION ALL sub-query that would otherwise be eligible for
--- flattening consists of two or more SELECT statements that do not all 
+-- flattening consists of two or more SELECT statements that do not all
 -- return the same number of result columns, the error is detected.
 --
 test:do_execsql_test(
@@ -938,7 +938,7 @@ test:do_catchsql_test(
     10.7,
     [[
         SELECT * FROM (
-          SELECT * FROM t UNION ALL 
+          SELECT * FROM t UNION ALL
           SELECT l,m,l FROM j UNION ALL
           SELECT * FROM k
         )
@@ -949,14 +949,14 @@ test:do_catchsql_test(
     [[
         SELECT * FROM (
           SELECT * FROM k UNION ALL
-          SELECT * FROM t UNION ALL 
-          SELECT l,m,l FROM j 
+          SELECT * FROM t UNION ALL
+          SELECT l,m,l FROM j
         )
     ]], err)
 
 -- 2015-02-09 Ticket [2f7170d73bf9abf80339187aa3677dce3dbcd5ca]
 -- "misuse of aggregate" error if aggregate column from FROM
--- subquery is used in correlated subquery 
+-- subquery is used in correlated subquery
 --
 test:do_execsql_test(
     11.1,
@@ -1023,7 +1023,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     11.5,
     [[
-        SELECT cnt, xyz, 
+        SELECT cnt, xyz,
                CASE WHEN (SELECT y FROM t2 WHERE w=cnt)=='two'
                     THEN 'aaa' ELSE 'bbb'
                 END, '|'
diff --git a/test/sql-tap/select7.test.lua b/test/sql-tap/select7.test.lua
index 7ff1f76d5..6b8f385e9 100755
--- a/test/sql-tap/select7.test.lua
+++ b/test/sql-tap/select7.test.lua
@@ -192,7 +192,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES(56.0);
     ]], {
         -- <select7-7.1>
-        
+
         -- </select7-7.1>
     })
 
@@ -215,7 +215,7 @@ test:do_execsql_test(
         INSERT INTO t4 VALUES( 3.0 );
     ]], {
         -- <select7-7.3>
-        
+
         -- </select7-7.3>
     })
 
@@ -232,7 +232,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select7-7.5",
     [[
-        SELECT a=0, typeof(a) FROM t4 
+        SELECT a=0, typeof(a) FROM t4
     ]], {
         -- <select7-7.5>
         false, "number", false, "number"
@@ -242,7 +242,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select7-7.6",
     [[
-        SELECT a=0, typeof(a) FROM t4 GROUP BY a 
+        SELECT a=0, typeof(a) FROM t4 GROUP BY a
     ]], {
         -- <select7-7.6>
         false, "number", false, "number"
diff --git a/test/sql-tap/select8.test.lua b/test/sql-tap/select8.test.lua
index c1bdd93a2..747dd9bca 100755
--- a/test/sql-tap/select8.test.lua
+++ b/test/sql-tap/select8.test.lua
@@ -32,9 +32,9 @@ test:execsql [[
     INSERT INTO songs VALUES(6,'two',11);
 ]]
 local result = test:execsql [[
-    SELECT DISTINCT artist,sum(timesplayed) AS total      
-    FROM songs      
-    GROUP BY LOWER(artist)      
+    SELECT DISTINCT artist,sum(timesplayed) AS total
+    FROM songs
+    GROUP BY LOWER(artist)
 ]]
 
 local function subrange(t, first, last)
@@ -48,27 +48,27 @@ end
 test:do_execsql_test(
     "select8-1.1",
     [[
-        SELECT DISTINCT artist,sum(timesplayed) AS total      
-        FROM songs      
-        GROUP BY LOWER(artist)      
+        SELECT DISTINCT artist,sum(timesplayed) AS total
+        FROM songs
+        GROUP BY LOWER(artist)
         LIMIT 1 OFFSET 1
     ]], subrange(result, 3, 4))
 
 test:do_execsql_test(
     "select8-1.2",
     [[
-        SELECT DISTINCT artist,sum(timesplayed) AS total      
-        FROM songs      
-        GROUP BY LOWER(artist)      
+        SELECT DISTINCT artist,sum(timesplayed) AS total
+        FROM songs
+        GROUP BY LOWER(artist)
         LIMIT 2 OFFSET 1
     ]], subrange(result, 3, 6))
 
 test:do_execsql_test(
     "select8-1.3",
     [[
-        SELECT DISTINCT artist,sum(timesplayed) AS total      
-        FROM songs      
-        GROUP BY LOWER(artist)      
+        SELECT DISTINCT artist,sum(timesplayed) AS total
+        FROM songs
+        GROUP BY LOWER(artist)
         LIMIT 1000 OFFSET 2
     ]], subrange(result, 5, #result))
 
diff --git a/test/sql-tap/select9.test.lua b/test/sql-tap/select9.test.lua
index 769f70069..ec09f2cd8 100755
--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -18,7 +18,7 @@ test.silent = true
 -- This file implements regression tests for sql library.
 --
 -- $Id: select9.test,v 1.4 2008/07/01 14:39:35 danielk1977 Exp $
--- The tests in this file are focused on test compound SELECT statements 
+-- The tests in this file are focused on test compound SELECT statements
 -- that have any or all of an ORDER BY, LIMIT or OFFSET clauses. As of
 -- version 3.6.0, sql contains code to use SQL indexes where possible
 -- to optimize such statements.
@@ -31,18 +31,18 @@ test.silent = true
 ---------------------------------------------------------------------------
 -- test_compound_select TESTNAME SELECT RESULT
 --
---   This command is used to run multiple LIMIT/OFFSET test cases based on 
+--   This command is used to run multiple LIMIT/OFFSET test cases based on
 --   the single SELECT statement passed as the second argument. The SELECT
 --   statement may not contain a LIMIT or OFFSET clause. This proc tests
 --   many statements of the form:
---    
+--
 --     "$SELECT limit $X offset $Y"
---    
+--
 --   for various values of $X and $Y.
---    
+--
 --   The third argument, $RESULT, should contain the expected result of
 --   the command [execsql $SELECT].
---    
+--
 --   The first argument, $TESTNAME, is used as the base test case name to
 --   pass to [do_test] for each individual LIMIT OFFSET test case.
 --
@@ -164,13 +164,13 @@ test:do_execsql_test(
         COMMIT;
     ]], {
         -- <select9-1.0>
-        
+
         -- </select9-1.0>
     })
 
 -- Each iteration of this loop runs the same tests with a different set
 -- of indexes present within the database schema. The data returned by
--- the compound SELECT statements in the test cases should be the same 
+-- the compound SELECT statements in the test cases should be the same
 -- in each case.
 --
 local iOuterLoop = 1
@@ -269,7 +269,7 @@ test:do_execsql_test(
         DROP INDEX i4 ON t2;
     ]], {
         -- <select9-2.0>
-        
+
         -- </select9-2.0>
     })
 
@@ -281,7 +281,7 @@ local _ = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
 --end
 
 --db("collate", "reverse", "reverse")
--- This loop is similar to the previous one (test cases select9-1.*) 
+-- This loop is similar to the previous one (test cases select9-1.*)
 -- except that the simple select statements have WHERE clauses attached
 -- to them. Sometimes the WHERE clause may be satisfied using the same
 -- index used for ORDER BY, sometimes not.
@@ -305,7 +305,7 @@ for _, indexes in ipairs({ [[
     test:do_execsql_test(
 "select9-2."..iOuterLoop..".1",
 indexes, {
-            
+
         })
 
     test_compound_select_flippable("select9-2."..iOuterLoop..".2", [[
@@ -346,7 +346,7 @@ test:do_execsql_test(
         DROP INDEX i3 ON t1;
     ]], {
         -- <select9-2.X>
-        
+
         -- </select9-2.X>
     })
 
@@ -371,7 +371,7 @@ test:do_execsql_test(
 --     SELECT t1.a FROM t1 UNION ALL SELECT t2.d FROM t2 ORDER BY 1
 --
 -- can use indexes to run without doing a in-memory sort operation.
--- This block of tests (select9-3.*) is used to check if the same 
+-- This block of tests (select9-3.*) is used to check if the same
 -- is possible with:
 --
 --     CREATE VIEW v1 AS SELECT a FROM t1 UNION ALL SELECT d FROM t2
@@ -524,7 +524,7 @@ test:do_test(
     })
 
 -- Full table scan if the "+x" prevents index usage.
--- 2013-07-09:  Ticket [490a4b7235624298]: 
+-- 2013-07-09:  Ticket [490a4b7235624298]:
 -- "WHERE 0" on the first element of a UNION causes an assertion fault
 --
 test:do_execsql_test(
diff --git a/test/sql-tap/selectB.test.lua b/test/sql-tap/selectB.test.lua
index f1f43af76..88f108f57 100755
--- a/test/sql-tap/selectB.test.lua
+++ b/test/sql-tap/selectB.test.lua
@@ -73,7 +73,7 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(2, 21, 24, 27);
     ]], {
         -- <selectB-1.1>
-        
+
         -- </selectB-1.1>
     })
 
@@ -86,7 +86,7 @@ for ii = 1, 2, 1 do
                 CREATE INDEX i2 ON t2(d);
             ]], {
                 -- <selectB-2.1>
-                
+
                 -- </selectB-2.1>
             })
 
@@ -102,40 +102,40 @@ for ii = 1, 2, 1 do
     SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1
   ]], { 2.0, 3.0, 8.0, 12.0, 14.0, 21.0})
     test_transform("selectB-"..ii..".4", [[
-    SELECT * FROM 
-      (SELECT a FROM t1 UNION ALL SELECT d FROM t2) 
+    SELECT * FROM
+      (SELECT a FROM t1 UNION ALL SELECT d FROM t2)
     WHERE a>10 ORDER BY 1
   ]], [[
     SELECT a FROM t1 WHERE a>10 UNION ALL SELECT d FROM t2 WHERE d>10 ORDER BY 1
   ]], { 12.0, 14.0, 21.0})
     test_transform("selectB-"..ii..".5", [[
-    SELECT * FROM 
-      (SELECT a FROM t1 UNION ALL SELECT d FROM t2) 
+    SELECT * FROM
+      (SELECT a FROM t1 UNION ALL SELECT d FROM t2)
     WHERE a>10 ORDER BY a
   ]], [[
-    SELECT a FROM t1 WHERE a>10 
-      UNION ALL 
-    SELECT d FROM t2 WHERE d>10 
+    SELECT a FROM t1 WHERE a>10
+      UNION ALL
+    SELECT d FROM t2 WHERE d>10
     ORDER BY a
   ]], { 12.0, 14.0, 21.0})
     test_transform("selectB-"..ii..".6", [[
-    SELECT * FROM 
-      (SELECT a FROM t1 UNION ALL SELECT d FROM t2 WHERE d > 12) 
+    SELECT * FROM
+      (SELECT a FROM t1 UNION ALL SELECT d FROM t2 WHERE d > 12)
     WHERE a>10 ORDER BY a
   ]], [[
     SELECT a FROM t1 WHERE a>10
-      UNION ALL 
+      UNION ALL
     SELECT d FROM t2 WHERE d>12 AND d>10
     ORDER BY a
   ]], { 14.0, 21.0})
     test_transform("selectB-"..ii..".7", [[
-    SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2) ORDER BY 1 
+    SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2) ORDER BY 1
     LIMIT 2
   ]], [[
     SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1 LIMIT 2
   ]], { 2.0, 3.0})
     test_transform("selectB-"..ii..".8", [[
-    SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2) ORDER BY 1 
+    SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2) ORDER BY 1
     LIMIT 2 OFFSET 3
   ]], [[
     SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1 LIMIT 2 OFFSET 3
@@ -143,7 +143,7 @@ for ii = 1, 2, 1 do
     test_transform("selectB-"..ii..".9", [[
     SELECT * FROM (
       SELECT a FROM t1 UNION ALL SELECT d FROM t2 UNION ALL SELECT c FROM t1
-    ) 
+    )
   ]], [[
     SELECT a FROM t1 UNION ALL SELECT d FROM t2 UNION ALL SELECT c FROM t1
   ]], { 2.0, 8.0, 14.0, 3.0, 12.0, 21.0, 6.0, 12.0, 18.0})
@@ -206,7 +206,7 @@ test:do_execsql_test(
         DROP INDEX i2 ON t2;
     ]], {
         -- <selectB-3.0>
-        
+
         -- </selectB-3.0>
     })
 
@@ -228,7 +228,7 @@ for ii = 3, 6, 1 do
                 CREATE INDEX i6 ON t2(f);
             ]], {
                 -- <selectB-5.0>
-                
+
                 -- </selectB-5.0>
             })
 
@@ -239,8 +239,8 @@ for ii = 3, 6, 1 do
     test:do_execsql_test(
         "selectB-"..ii..".1",
         [[
-            SELECT DISTINCT * FROM 
-              (SELECT c FROM t1 UNION ALL SELECT e FROM t2) 
+            SELECT DISTINCT * FROM
+              (SELECT c FROM t1 UNION ALL SELECT e FROM t2)
             ORDER BY 1;
         ]], {
             6, 12, 15, 18, 24
@@ -249,8 +249,8 @@ for ii = 3, 6, 1 do
     test:do_execsql_test(
         "selectB-"..ii..".2",
         [[
-            SELECT c, count(*) FROM 
-              (SELECT c FROM t1 UNION ALL SELECT e FROM t2) 
+            SELECT c, count(*) FROM
+              (SELECT c FROM t1 UNION ALL SELECT e FROM t2)
             GROUP BY c ORDER BY 1;
         ]], {
             6, 2, 12, 1, 15, 1, 18, 1, 24, 1
@@ -259,8 +259,8 @@ for ii = 3, 6, 1 do
     test:do_execsql_test(
         "selectB-"..ii..".3",
         [[
-            SELECT c, count(*) FROM 
-              (SELECT c FROM t1 UNION ALL SELECT e FROM t2) 
+            SELECT c, count(*) FROM
+              (SELECT c FROM t1 UNION ALL SELECT e FROM t2)
             GROUP BY c HAVING count(*)>1;
         ]], {
             6, 2
@@ -269,7 +269,7 @@ for ii = 3, 6, 1 do
     test:do_execsql_test(
         "selectB-"..ii..".4",
         [[
-            SELECT t4.c, t3.a FROM 
+            SELECT t4.c, t3.a FROM
               (SELECT c FROM t1 UNION ALL SELECT e FROM t2) AS t4, t1 AS t3
             WHERE t3.a=14
             ORDER BY 1
@@ -280,28 +280,28 @@ for ii = 3, 6, 1 do
     test:do_execsql_test(
         "selectB-"..ii..".5",
         [[
-            SELECT d FROM t2 
-            EXCEPT 
+            SELECT d FROM t2
+            EXCEPT
             SELECT a FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2)
         ]], {
-            
+
         })
 
     test:do_execsql_test(
         "selectB-"..ii..".6",
         [[
             SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2)
-            EXCEPT 
+            EXCEPT
             SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2)
         ]], {
-            
+
         })
 
     test:do_execsql_test(
         "selectB-"..ii..".7",
         [[
             SELECT c FROM t1
-            EXCEPT 
+            EXCEPT
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
         ]], {
             12
@@ -311,7 +311,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".8",
         [[
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
-            EXCEPT 
+            EXCEPT
             SELECT c FROM t1
         ]], {
             9, 15, 24, 27
@@ -321,7 +321,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".9",
         [[
             SELECT c FROM t1
-            UNION 
+            UNION
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
             ORDER BY c
         ]], {
@@ -341,7 +341,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".11",
         [[
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
-            UNION 
+            UNION
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
             ORDER BY 1
         ]], {
@@ -352,7 +352,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".12",
         [[
             SELECT c FROM t1
-            INTERSECT 
+            INTERSECT
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
             ORDER BY 1
         ]], {
@@ -363,7 +363,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".13",
         [[
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
-            INTERSECT 
+            INTERSECT
             SELECT c FROM t1
             ORDER BY 1
         ]], {
@@ -374,7 +374,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".14",
         [[
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
-            INTERSECT 
+            INTERSECT
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
             ORDER BY 1
         ]], {
diff --git a/test/sql-tap/selectC.test.lua b/test/sql-tap/selectC.test.lua
index 20a0203a6..5c66b187d 100755
--- a/test/sql-tap/selectC.test.lua
+++ b/test/sql-tap/selectC.test.lua
@@ -288,10 +288,10 @@ test:do_execsql_test(
 --     INSERT INTO person VALUES('lakeside', 'amy', NULL);
 --     INSERT INTO person VALUES('lake-apts', 'tom', NULL);
 --     INSERT INTO person VALUES('acorn', 'hideo', 'CQB421');
---     SELECT 
---       org_id, 
+--     SELECT
+--       org_id,
 --       count((NOT (org_id IS NULL)) AND (NOT (nickname IS NULL)))
---     FROM person 
+--     FROM person
 --     WHERE (CASE WHEN license != '' THEN 1 ELSE 0 END)
 --     GROUP BY 1;
 --   }
diff --git a/test/sql-tap/selectE.test.lua b/test/sql-tap/selectE.test.lua
index fb1bc8794..83582d0e2 100755
--- a/test/sql-tap/selectE.test.lua
+++ b/test/sql-tap/selectE.test.lua
@@ -16,7 +16,7 @@ test:plan(7)
 -- This file implements regression tests for compound SELECT statements
 -- that have ORDER BY clauses with collating sequences that differ
 -- from the collating sequence used for comparison in the compound.
--- 
+--
 -- Ticket 6709574d2a8d8b9be3a9cb1afbf4ff2de48ea4e7:
 -- drh added on 2013-05-06 15:21:16:
 --
@@ -27,22 +27,22 @@ test:plan(7)
 -- operator. Note that the ".print" commands are instructions to the
 -- sql.exe shell program to output delimiter lines so that you can more
 -- easily tell where the output of one query ends and the next query
--- begins. 
--- 
+-- begins.
+--
 --     CREATE TABLE t1(a TEXT);
 --     INSERT INTO t1 VALUES('abc'),('def');
 --     CREATE TABLE t2(a TEXT);
 --     INSERT INTO t2 VALUES('DEF');
--- 
+--
 --     SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a;
 --     .print -----
 --     SELECT a FROM (SELECT a FROM t1 EXCEPT SELECT a FROM t2)
 --      ORDER BY a COLLATE nocase;
 --     .print -----
 --     SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a COLLATE nocase;
--- 
+--
 -- Bisecting shows that this problem was introduced in sql version 3.6.0
--- by check-in [8bbfa97837a74ef] on 2008-06-15. 
+-- by check-in [8bbfa97837a74ef] on 2008-06-15.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -118,7 +118,7 @@ test:do_test(
         ]]
     end, {
         -- <selectE-2.1>
-        
+
         -- </selectE-2.1>
     })
 
@@ -131,7 +131,7 @@ test:do_test(
         ]]
     end, {
         -- <selectE-2.2>
-        
+
         -- </selectE-2.2>
     })
 
diff --git a/test/sql-tap/selectF.test.lua b/test/sql-tap/selectF.test.lua
index 2a86a4da8..fc21d1591 100755
--- a/test/sql-tap/selectF.test.lua
+++ b/test/sql-tap/selectF.test.lua
@@ -36,16 +36,16 @@ test:do_execsql_test(
 
 --explain_i {
 --  SELECT * FROM t2
---  UNION ALL 
---  SELECT * FROM t1 WHERE a<5 
+--  UNION ALL
+--  SELECT * FROM t1 WHERE a<5
 --  ORDER BY 2, 1
 --}
 test:do_execsql_test(
     2,
     [[
         SELECT * FROM t2
-        UNION ALL 
-        SELECT * FROM t1 WHERE a<5 
+        UNION ALL
+        SELECT * FROM t1 WHERE a<5
         ORDER BY 2, 1
     ]], {
         -- <2>
diff --git a/test/sql-tap/subquery.test.lua b/test/sql-tap/subquery.test.lua
index 2f92da96c..c85c222b6 100755
--- a/test/sql-tap/subquery.test.lua
+++ b/test/sql-tap/subquery.test.lua
@@ -137,7 +137,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "subquery-1.9.2",
     [[
-        SELECT a FROM t1 WHERE (SELECT (y*2)>b FROM t2 WHERE a=x); 
+        SELECT a FROM t1 WHERE (SELECT (y*2)>b FROM t2 WHERE a=x);
     ]], {
         -- <subquery-1.9.2>
         3, 5, 7
@@ -191,7 +191,7 @@ test:do_execsql_test(
         INSERT INTO t5 VALUES(5, '2003-4');
 
         SELECT period, vsum
-        FROM (SELECT 
+        FROM (SELECT
           a.period,
           (select sum(val) from t5 where period between a.period and '2002-4') vsum
           FROM t5 a where a.period between '2002-1' and '2002-4')
@@ -208,7 +208,7 @@ test:do_execsql_test(
         SELECT period, vsum from
           (select a.period,
           (select sum(val) from t5 where period between a.period and '2002-4') vsum
-        FROM t5 a where a.period between '2002-1' and '2002-4') 
+        FROM t5 a where a.period between '2002-1' and '2002-4')
         WHERE vsum < 45 ;
     ]], {
         -- <subquery-1.10.5>
@@ -222,7 +222,7 @@ test:do_execsql_test(
         DROP TABLE t5;
     ]], {
         -- <subquery-1.10.6>
-        
+
         -- </subquery-1.10.6>
     })
 
@@ -249,7 +249,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES(3, 1);
     ]], {
         -- <subquery-2.2.1>
-        
+
         -- </subquery-2.2.1>
     })
 
@@ -269,7 +269,7 @@ test:do_execsql_test(
         DROP TABLE t3;
     ]], {
         -- <subquery-2.2.3>
-        
+
         -- </subquery-2.2.3>
     })
 
@@ -280,7 +280,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES('10');
     ]], {
         -- <subquery-2.3.1>
-        
+
         -- </subquery-2.3.1>
     })
 
@@ -300,7 +300,7 @@ test:do_execsql_test(
         DROP TABLE t3;
     ]], {
         -- <subquery-2.3.3>
-        
+
         -- </subquery-2.3.3>
     })
 
@@ -311,7 +311,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES('XX');
     ]], {
         -- <subquery-2.4.1>
-        
+
         -- </subquery-2.4.1>
     })
 
@@ -331,7 +331,7 @@ test:do_execsql_test(
         DROP TABLE t3;
     ]], {
         -- <subquery-2.4.3>
-        
+
         -- </subquery-2.4.3>
     })
 
@@ -582,8 +582,8 @@ test:do_execsql_test(
     })
 
 --------------------------------------------------------------------
--- These tests - subquery-4.* - use the TCL statement cache to try 
--- and expose bugs to do with re-using statements that have been 
+-- These tests - subquery-4.* - use the TCL statement cache to try
+-- and expose bugs to do with re-using statements that have been
 -- passed to sql_reset().
 --
 -- One problem was that VDBE memory cells were not being initialized
@@ -620,7 +620,7 @@ test:do_test(
         return test:execsql "INSERT INTO t3 VALUES((SELECT max(a) FROM t3)+1)"
     end, {
         -- <subquery-4.2.1>
-        
+
         -- </subquery-4.2.1>
     })
 
@@ -630,7 +630,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES((SELECT max(a) FROM t3)+1)
     ]], {
         -- <subquery-4.2.2>
-        
+
         -- </subquery-4.2.2>
     })
 
@@ -862,7 +862,7 @@ test:do_execsql_test(
         SELECT (SELECT 0 FROM (SELECT * FROM (SELECT 0))) AS x WHERE x <> 0;
     ]], {
         -- <subquery-8.1>
-        
+
         -- </subquery-8.1>
     })
 
diff --git a/test/sql-tap/subquery2.test.lua b/test/sql-tap/subquery2.test.lua
index 92fe33d04..a499515b5 100755
--- a/test/sql-tap/subquery2.test.lua
+++ b/test/sql-tap/subquery2.test.lua
@@ -90,7 +90,7 @@ test:do_execsql_test(
     "subquery2-1.21",
     [[
         SELECT a FROM t1
-         WHERE +b=(SELECT x+1 FROM 
+         WHERE +b=(SELECT x+1 FROM
                      (SELECT DISTINCT f/d AS x FROM t2 JOIN t3 ON d*a=f))
     ]], {
         -- <subquery2-1.21>
@@ -102,7 +102,7 @@ test:do_execsql_test(
     "subquery2-1.22",
     [[
         SELECT a FROM t1
-         WHERE b=(SELECT x+1 FROM 
+         WHERE b=(SELECT x+1 FROM
                      (SELECT DISTINCT f/d AS x FROM t2 JOIN t3 ON d*a=f))
     ]], {
         -- <subquery2-1.22>
@@ -129,7 +129,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     2.2,
     [[
-        SELECT * 
+        SELECT *
         FROM (SELECT * FROM t4 ORDER BY a LIMIT 1000000 OFFSET 1)
         LIMIT (SELECT a FROM t5)
     ]], {
@@ -140,7 +140,7 @@ test:do_execsql_test(
 
 -----------------------------------------------------------------------------
 -- Ticket http://www.sql.org/src/info/d11a6e908f (2014-09-20)
--- Query planner fault on three-way nested join with compound inner SELECT 
+-- Query planner fault on three-way nested join with compound inner SELECT
 --
 test:do_execsql_test(
     3.0,
diff --git a/test/sql-tap/subselect.test.lua b/test/sql-tap/subselect.test.lua
index b6a20948d..f8ba3fb9e 100755
--- a/test/sql-tap/subselect.test.lua
+++ b/test/sql-tap/subselect.test.lua
@@ -91,7 +91,7 @@ test:do_execsql_test(
         SELECT b from t1 where a = (SELECT a FROM t1 WHERE b=8)
     ]], {
         -- <subselect-1.3d>
-        
+
         -- </subselect-1.3d>
     })
 
@@ -134,7 +134,7 @@ test:do_test(
             INSERT INTO t2 VALUES(4,16);
         ]]
         return test:execsql [[
-            SELECT y from t2 
+            SELECT y from t2
             WHERE x = (SELECT sum(b) FROM t1 where a is not null) - (SELECT sum(a) FROM t1)
         ]]
     end, {
diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua
index bb36d994e..7e9b08cdb 100755
--- a/test/sql-tap/table.test.lua
+++ b/test/sql-tap/table.test.lua
@@ -29,7 +29,7 @@ test:do_execsql_test(
         )
     ]], {
         -- <table-1.1>
-        
+
         -- </table-1.1>
     })
 
@@ -62,7 +62,7 @@ test:do_test(
         --execsql {SELECT * FROM sql_master WHERE type!='meta'}
     end, {
         -- <table-1.5>
-        
+
         -- </table-1.5>
     })
 
@@ -83,7 +83,7 @@ test:do_test(
         --execsql {SELECT name FROM sql_master WHERE type!='meta'}
     end, {
         -- <table-1.10>
-        
+
         -- </table-1.10>
     })
 
@@ -95,7 +95,7 @@ test:do_test(
         --execsql {SELECT name FROM "sql_master" WHERE type!='meta'}
     end, {
         -- <table-1.11>
-        
+
         -- </table-1.11>
     })
 
@@ -106,7 +106,7 @@ test:do_test(
         --execsql {SELECT name as "X" FROM sql_master WHERE type!='meta'}
     end, {
         -- <table-1.12>
-        
+
         -- </table-1.12>
     })
 
@@ -118,7 +118,7 @@ test:do_test(
         --execsql {SELECT name FROM "sql_master" WHERE type!='meta'}
     end, {
         -- <table-1.13>
-        
+
         -- </table-1.13>
     })
 
@@ -171,7 +171,7 @@ test:do_execsql_test(
         DROP TABLE test2; --SELECT name FROM sql_master WHERE type!='meta'
     ]], {
         -- <table-2.1f>
-        
+
         -- </table-2.1f>
     })
 
@@ -185,7 +185,7 @@ test:do_test(
         --catchsql {CREATE TABLE test3(id primary key, two text)}
     end, {
         -- <table-2.2a>
-        
+
         -- </table-2.2a>
     })
 
@@ -220,7 +220,7 @@ test:do_test(
         --execsql {SELECT name FROM sql_master WHERE type!='meta' ORDER BY name}
     end, {
         -- <table-2.2f>
-        
+
         -- </table-2.2f>
     })
 
@@ -255,7 +255,7 @@ test:do_test(
         --execsql {SELECT sql FROM sql_master WHERE type=='table'}
     end, {
         -- <table-3.1>
-        
+
         -- </table-3.1>
     })
 
@@ -303,7 +303,7 @@ test:do_test(
         --execsql {SELECT name FROM sql_master WHERE type!='meta'}
     end, {
         -- <table-3.6>
-        
+
         -- </table-3.6>
     })
 
@@ -365,7 +365,7 @@ test:do_test(
         return test:execsql [[SELECT "name" FROM "_space" WHERE "id">500]]
     end, {
         -- <table-4.3>
-        
+
         -- </table-4.3>
     })
 
@@ -436,7 +436,7 @@ if is_gh_5742_closed
             ]]
         end, {
             -- <table-5.2.2>
-            
+
             -- </table-5.2.2>
         })
 
@@ -453,7 +453,7 @@ test:do_test(
         --execsql {SELECT name FROM sql_master WHERE type!='meta'}
     end, {
         -- <table-5.3>
-        
+
         -- </table-5.3>
     })
 
@@ -482,7 +482,7 @@ test:do_test(
 --  set list [glob -nocomplain testdb/spaces*.tbl]
 --} {testdb/spaces+in+this+name+.tbl}
 -- Try using keywords as table names or column names.
--- 
+--
 test:do_catchsql_test(
     "table-7.1",
     [=[
@@ -959,7 +959,7 @@ test:do_execsql_test(
         SELECT * FROM tablet8;
     ]], {
         -- <table-13.1>
-        
+
         -- </table-13.1>
     })
 end
@@ -1008,7 +1008,7 @@ test:do_test(
     })
 end
 -- ifcapable attach {
---   # Now attach a database and ensure that a table can be created in the 
+--   # Now attach a database and ensure that a table can be created in the
 --   # attached database whilst in a callback from a query on the main database.
 --   do_test table-14.3 {
 --     forcedelete test2.db
@@ -1020,7 +1020,7 @@ end
 --       db eval {CREATE TABLE aux.t1(a, b, c)}
 --     }
 --   } {}
---   # On the other hand, it should be impossible to drop a table when any VMs 
+--   # On the other hand, it should be impossible to drop a table when any VMs
 --   # are active. This is because VerifyCookie instructions may have already
 --   # been executed, and btree root-pages may not move after this (which a
 --   # delete table might do).
@@ -1031,7 +1031,7 @@ end
 --           db eval {DROP TABLE aux.t1;}
 --         }
 --       } msg
---     ] 
+--     ]
 --     set result [list $rc $msg]
 --   } {1 {database table is locked}}
 -- }
@@ -1051,7 +1051,7 @@ test:do_test(
         return
     end, {
         -- <table-15.1>
-        
+
         -- </table-15.1>
     })
 
@@ -1066,7 +1066,7 @@ test:do_test(
         return
     end, {
         -- <table-15.2>
-        
+
         -- </table-15.2>
     })
 
diff --git a/test/sql-tap/tkt-02a8e81d44.test.lua b/test/sql-tap/tkt-02a8e81d44.test.lua
index 1ab0e175c..9b95a9d79 100755
--- a/test/sql-tap/tkt-02a8e81d44.test.lua
+++ b/test/sql-tap/tkt-02a8e81d44.test.lua
@@ -16,7 +16,7 @@ test:plan(1)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket [02a8e81d44] has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt-31338dca7e.test.lua b/test/sql-tap/tkt-31338dca7e.test.lua
index 6f11b0eb5..41dbc4520 100755
--- a/test/sql-tap/tkt-31338dca7e.test.lua
+++ b/test/sql-tap/tkt-31338dca7e.test.lua
@@ -202,7 +202,7 @@ if (1 > 0)
                 CREATE TABLE t5(a  INT primary key,b INT ,c INT ,d INT ,e INT ,f INT );
                 CREATE TABLE t6(g  INT primary key,h INT );
                 CREATE TRIGGER t6r AFTER INSERT ON t6 FOR EACH ROW BEGIN
-                  INSERT INTO t5    
+                  INSERT INTO t5
                     SELECT * FROM t3 LEFT JOIN t1 ON d=g LEFT JOIN t4 ON c=h
                      WHERE (a=1 AND h=4)
                         OR (b IN (
diff --git a/test/sql-tap/tkt-385a5b56b9.test.lua b/test/sql-tap/tkt-385a5b56b9.test.lua
index fe314e802..3a1d66cf3 100755
--- a/test/sql-tap/tkt-385a5b56b9.test.lua
+++ b/test/sql-tap/tkt-385a5b56b9.test.lua
@@ -29,7 +29,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "1.1",
     [[
-        SELECT DISTINCT x, y FROM t1 
+        SELECT DISTINCT x, y FROM t1
     ]], {
         -- <1.1>
         1, "", 2, ""
@@ -45,7 +45,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "1.3",
     [[
-        SELECT DISTINCT x, y FROM t1 
+        SELECT DISTINCT x, y FROM t1
     ]], {
         -- <1.3>
         1, "", 2, ""
diff --git a/test/sql-tap/tkt-3a77c9714e.test.lua b/test/sql-tap/tkt-3a77c9714e.test.lua
index b529d32bc..43ff8781c 100755
--- a/test/sql-tap/tkt-3a77c9714e.test.lua
+++ b/test/sql-tap/tkt-3a77c9714e.test.lua
@@ -16,7 +16,7 @@ test:plan(4)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket [3a77c9714e] has been
--- fixed.  
+-- fixed.
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 
@@ -66,9 +66,9 @@ test:do_execsql_test(
     [[
         SELECT
           SrcWord, Beginnings.Title
-          FROM 
+          FROM
             (SELECT 'FACTORING' AS SrcWord UNION SELECT 'SWIMMING' AS SrcWord )
-          LEFT JOIN 
+          LEFT JOIN
             Beginnings
           WHERE Beginnings.Id= (
             SELECT BeginningId FROM (
diff --git a/test/sql-tap/tkt-4a03edc4c8.test.lua b/test/sql-tap/tkt-4a03edc4c8.test.lua
index 1bbaed30b..badc67e71 100755
--- a/test/sql-tap/tkt-4a03edc4c8.test.lua
+++ b/test/sql-tap/tkt-4a03edc4c8.test.lua
@@ -16,7 +16,7 @@ test:plan(1)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that
--- ticket [4a03edc4c8c028c93e9269f64fc5e97f632c1166] has been fixed.  
+-- ticket [4a03edc4c8c028c93e9269f64fc5e97f632c1166] has been fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt-4dd95f6943.test.lua b/test/sql-tap/tkt-4dd95f6943.test.lua
index 5f6077d2a..ff89cb4f8 100755
--- a/test/sql-tap/tkt-4dd95f6943.test.lua
+++ b/test/sql-tap/tkt-4dd95f6943.test.lua
@@ -139,7 +139,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.5", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s
                 ORDER BY a, x ASC, y ASC;
             ]], inexpr), {
                 4, 1, 2, 4, 1, 4, 4, 1, 5
@@ -148,7 +148,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.6", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s
                 ORDER BY x ASC, y ASC;
             ]], inexpr), {
                 2, 1, 2, 2, 1, 4, 2, 1, 5
@@ -157,7 +157,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.7", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s
                 ORDER BY a, x ASC, y DESC;
             ]], inexpr), {
                 4, 1, 5, 4, 1, 4, 4, 1, 2
@@ -166,7 +166,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             "2."..tn1..".8",
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s
                 ORDER BY x ASC, y DESC;
             ]], inexpr), {
                 2, 1, 5, 2, 1, 4, 2, 1, 2
@@ -175,7 +175,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.9", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s
                 ORDER BY a, x DESC, y ASC;
             ]], inexpr), {
                 4, 1, 2, 4, 1, 4, 4, 1, 5
@@ -184,7 +184,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             "2."..tn1..".10",
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s
                 ORDER BY x DESC, y ASC;
             ]], inexpr), {
                 2, 1, 2, 2, 1, 4, 2, 1, 5
@@ -193,7 +193,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.11", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s
                 ORDER BY a, x DESC, y DESC;
             ]], inexpr), {
                 4, 1, 5, 4, 1, 4, 4, 1, 2
@@ -202,7 +202,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.12", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s
                 ORDER BY x DESC, y DESC;
             ]], inexpr), {
                 2, 1, 5, 2, 1, 4, 2, 1, 2
diff --git a/test/sql-tap/tkt-54844eea3f.test.lua b/test/sql-tap/tkt-54844eea3f.test.lua
index bfb94507c..ae24d0a02 100755
--- a/test/sql-tap/tkt-54844eea3f.test.lua
+++ b/test/sql-tap/tkt-54844eea3f.test.lua
@@ -39,7 +39,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES(3);
     ]], {
         -- <1.0>
-        
+
         -- </1.0>
     })
 
@@ -47,7 +47,7 @@ test:do_execsql_test(
     "1.1",
     [[
         SELECT 'test-2', t3.c, (
-              SELECT count(*) 
+              SELECT count(*)
               FROM t1 JOIN (SELECT DISTINCT t3.c AS p FROM t2) AS x ON t1.a=x.p
         )
         FROM t3;
@@ -65,7 +65,7 @@ test:do_execsql_test(
         INSERT INTO t4 VALUES(2, 'a', '2', 'two');
         INSERT INTO t4 VALUES(3, 'b', '1', 'three');
         INSERT INTO t4 VALUES(4, 'b', '2', 'four');
-        SELECT ( 
+        SELECT (
           SELECT c FROM (
             SELECT a,b,c FROM t4 WHERE a=output.a ORDER BY b LIMIT 10 OFFSET 1
           ) WHERE b=output.b
diff --git a/test/sql-tap/tkt-752e1646fc.test.lua b/test/sql-tap/tkt-752e1646fc.test.lua
index a7c6978f8..924a4834f 100755
--- a/test/sql-tap/tkt-752e1646fc.test.lua
+++ b/test/sql-tap/tkt-752e1646fc.test.lua
@@ -16,7 +16,7 @@ test:plan(1)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket [752e1646fc] has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -24,9 +24,9 @@ test:do_execsql_test(
     "tkt-752e1646fc-1.1",
     [[
         CREATE TABLE "test" ("letter" VARCHAR(1) PRIMARY KEY, "number" INTEGER NOT NULL);
-        INSERT INTO "test" ("letter", "number") VALUES('b', 1); 
-        INSERT INTO "test" ("letter", "number") VALUES('a', 2); 
-        INSERT INTO "test" ("letter", "number") VALUES('c', 2); 
+        INSERT INTO "test" ("letter", "number") VALUES('b', 1);
+        INSERT INTO "test" ("letter", "number") VALUES('a', 2);
+        INSERT INTO "test" ("letter", "number") VALUES('c', 2);
         SELECT DISTINCT "number" FROM (SELECT "letter", "number" FROM "test" ORDER BY "letter", "number" LIMIT 1) AS "test";
     ]], {
         -- <tkt-752e1646fc-1.1>
diff --git a/test/sql-tap/tkt-7bbfb7d442.test.lua b/test/sql-tap/tkt-7bbfb7d442.test.lua
index 1a748217d..448f884d8 100755
--- a/test/sql-tap/tkt-7bbfb7d442.test.lua
+++ b/test/sql-tap/tkt-7bbfb7d442.test.lua
@@ -16,7 +16,7 @@ test:plan(5)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket [7bbfb7d442] has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -40,7 +40,7 @@ if (1 > 0)
             CREATE TRIGGER t3t AFTER INSERT ON t3 FOR EACH ROW
             WHEN new.t3_d IS NULL BEGIN
               UPDATE t3 SET t3_d = (
-                SELECT d FROM 
+                SELECT d FROM
                   (SELECT * FROM t2 WHERE (new.t3_a%2)=(id%2) LIMIT 10),
                   (SELECT * FROM t1 WHERE (new.t3_a%2)=(id%2) LIMIT 10)
                 WHERE a = new.t3_a AND b = c
@@ -64,7 +64,7 @@ if (1 > 0)
     test:do_execsql_test(
         1.3,
         [[
-            DELETE FROM t3 
+            DELETE FROM t3
         ]])
 
     test:do_execsql_test(
@@ -81,7 +81,7 @@ if (1 > 0)
 
 
     ---------------------------------------------------------------------------
-    -- The following test case - 2.* - is from the original bug report as 
+    -- The following test case - 2.* - is from the original bug report as
     -- posted to the mailing list.
     --
     test:do_execsql_test(
@@ -97,8 +97,8 @@ if (1 > 0)
             );
 
             CREATE TRIGGER TGR_InventoryControl_AfterInsert
-            AFTER INSERT ON InventoryControl 
-            FOR EACH ROW WHEN NEW.ControlState=-1 BEGIN 
+            AFTER INSERT ON InventoryControl
+            FOR EACH ROW WHEN NEW.ControlState=-1 BEGIN
 
             INSERT OR REPLACE INTO InventoryControl(
                   InventoryControlId,SKU,Variant,ControlDate,ControlState,DeliveredQty
@@ -160,7 +160,7 @@ if (1 > 0)
             INSERT INTO TransactionDetail(TransactionId, SKU, Variant) VALUES(44, 31, 0);
 
 
-            INSERT INTO InventoryControl(SKU, Variant, ControlDate) SELECT 
+            INSERT INTO InventoryControl(SKU, Variant, ControlDate) SELECT
                 II.SKU AS SKU, II.Variant AS Variant, '2011-08-30' AS ControlDate
                 FROM InventoryItem II;
         ]])
diff --git a/test/sql-tap/tkt-80ba201079.test.lua b/test/sql-tap/tkt-80ba201079.test.lua
index 7b961aacd..30bdf5457 100755
--- a/test/sql-tap/tkt-80ba201079.test.lua
+++ b/test/sql-tap/tkt-80ba201079.test.lua
@@ -72,13 +72,13 @@ test:do_test(
 -- do_test tkt-80ba2-150 {
 --   optimization_control db factor-constants 1
 --   db cache flush
---   set x1 [db eval {EXPLAIN 
+--   set x1 [db eval {EXPLAIN
 --     SELECT * FROM t1, t2
 --      WHERE (a='A' AND b='X')
 --         OR (a='A' AND EXISTS (SELECT * FROM t3 WHERE c='C'));}]
 --   optimization_control db factor-constants 0
 --   db cache flush
---   set x2 [db eval {EXPLAIN 
+--   set x2 [db eval {EXPLAIN
 --     SELECT * FROM t1, t2
 --      WHERE (a='A' AND b='X')
 --         OR (a='A' AND EXISTS (SELECT * FROM t3 WHERE c='C'));}]
diff --git a/test/sql-tap/tkt-8c63ff0ec.test.lua b/test/sql-tap/tkt-8c63ff0ec.test.lua
index 3473b9105..703fd20f7 100755
--- a/test/sql-tap/tkt-8c63ff0ec.test.lua
+++ b/test/sql-tap/tkt-8c63ff0ec.test.lua
@@ -13,11 +13,11 @@ test:plan(3)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- Test cases to show that ticket [8c63ff0eca81a9132d8d67b31cd6ae9712a2cc6f]
 -- "Incorrect query result on a UNION ALL" which was caused by using the same
 -- temporary register in concurrent co-routines, as been fixed.
--- 
+--
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 test:do_execsql_test(
diff --git a/test/sql-tap/tkt-91e2e8ba6f.test.lua b/test/sql-tap/tkt-91e2e8ba6f.test.lua
index dac546f10..f575e213f 100755
--- a/test/sql-tap/tkt-91e2e8ba6f.test.lua
+++ b/test/sql-tap/tkt-91e2e8ba6f.test.lua
@@ -12,7 +12,7 @@ test:plan(7)
 -------------------------------------------------------------------------
 --
 -- This file contains tests for sql. Specifically, it tests that sql
--- does not crash and an error is returned if localhost() fails. This 
+-- does not crash and an error is returned if localhost() fails. This
 -- is the problem reported by ticket 91e2e8ba6f.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
@@ -24,7 +24,7 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES(11, 11);
     ]], {
         -- <1.1>
-        
+
         -- </1.1>
     })
 
@@ -71,7 +71,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.6,
     [[
-        SELECT a.x/10, a.y/10 FROM 
+        SELECT a.x/10, a.y/10 FROM
           (SELECT * FROM t1 LIMIT 5 OFFSET 0) AS a, t1 AS b WHERE a.x = b.x
         LIMIT 5 OFFSET 0;
     ]], {
diff --git a/test/sql-tap/tkt-a8a0d2996a.test.lua b/test/sql-tap/tkt-a8a0d2996a.test.lua
index 4878f8436..0dfa4653d 100755
--- a/test/sql-tap/tkt-a8a0d2996a.test.lua
+++ b/test/sql-tap/tkt-a8a0d2996a.test.lua
@@ -13,7 +13,7 @@ test:plan(12)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- Tests to verify that arithmetic operators do not change the type of
 -- input operands.  Ticket [a8a0d2996a]
 --
diff --git a/test/sql-tap/tkt-ba7cbfaedc.test.lua b/test/sql-tap/tkt-ba7cbfaedc.test.lua
index 7ceda9270..ed12a8f5a 100755
--- a/test/sql-tap/tkt-ba7cbfaedc.test.lua
+++ b/test/sql-tap/tkt-ba7cbfaedc.test.lua
@@ -23,11 +23,11 @@ test:do_execsql_test(
     [[
         CREATE TABLE t1 (id  INT primary key, x INT , y TEXT);
         INSERT INTO t1 VALUES (1, 3, 'a');
-        INSERT INTO t1 VALUES (2, 1, 'a'); 
+        INSERT INTO t1 VALUES (2, 1, 'a');
         INSERT INTO t1 VALUES (3, 2, 'b');
         INSERT INTO t1 VALUES (4, 2, 'a');
         INSERT INTO t1 VALUES (5, 3, 'b');
-        INSERT INTO t1 VALUES (6, 1, 'b'); 
+        INSERT INTO t1 VALUES (6, 1, 'b');
     ]])
 
 test:do_execsql_test(
diff --git a/test/sql-tap/tkt-bd484a090c.test.lua b/test/sql-tap/tkt-bd484a090c.test.lua
index 6cd219722..29cb21fd2 100755
--- a/test/sql-tap/tkt-bd484a090c.test.lua
+++ b/test/sql-tap/tkt-bd484a090c.test.lua
@@ -13,7 +13,7 @@ test:plan(0)
 -------------------------------------------------------------------------
 --
 -- This file contains tests for sql. Specifically, it tests that sql
--- does not crash and an error is returned if localhost() fails. This 
+-- does not crash and an error is returned if localhost() fails. This
 -- is the problem reported by ticket bd484a090c.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/tkt-f973c7ac31.test.lua b/test/sql-tap/tkt-f973c7ac31.test.lua
index b44203e54..07fbc1fc1 100755
--- a/test/sql-tap/tkt-f973c7ac31.test.lua
+++ b/test/sql-tap/tkt-f973c7ac31.test.lua
@@ -25,7 +25,7 @@ test:do_execsql_test(
         INSERT INTO t VALUES(2, 5, 4);
     ]], {
         -- <tkt-f973c7ac3-1.0>
-        
+
         -- </tkt-f973c7ac3-1.0>
     })
 
@@ -46,7 +46,7 @@ for tn, sql in ipairs(sqls) do
     test:do_execsql_test(
         "tkt-f973c7ac3-1."..tn..".2",
         [[
-            SELECT c1,c2 FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 DESC 
+            SELECT c1,c2 FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 DESC
         ]], {
             5, 5, 5, 4
         })
@@ -85,7 +85,7 @@ for tn, sql in ipairs(sqls) do
     test:do_execsql_test(
         "tkt-f973c7ac3-1."..tn..".7",
         [[
-            SELECT c1,c2 FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 ASC 
+            SELECT c1,c2 FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 ASC
         ]], {
             5, 4, 5, 5
         })
diff --git a/test/sql-tap/tkt-fa7bf5ec.test.lua b/test/sql-tap/tkt-fa7bf5ec.test.lua
index dbe168422..fd952db7d 100755
--- a/test/sql-tap/tkt-fa7bf5ec.test.lua
+++ b/test/sql-tap/tkt-fa7bf5ec.test.lua
@@ -20,9 +20,9 @@ test:plan(1)
 -- The problem described by this ticket was that the sqlExprCompare()
 -- function was saying that expressions (x='a') and (x='A') were identical
 -- because it was using sqlStrICmp() instead of strcmp() to compare string
--- literals.  That was causing the query optimizer for aggregate queries to 
--- believe that both count() operations were identical, and thus only 
--- computing the first count() and making a copy of the result for the 
+-- literals.  That was causing the query optimizer for aggregate queries to
+-- believe that both count() operations were identical, and thus only
+-- computing the first count() and making a copy of the result for the
 -- second count().
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/tkt1443.test.lua b/test/sql-tap/tkt1443.test.lua
index f40ca16d1..d0b56b082 100755
--- a/test/sql-tap/tkt1443.test.lua
+++ b/test/sql-tap/tkt1443.test.lua
@@ -16,7 +16,7 @@ test:plan(3)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1433 has been
--- fixed.  
+-- fixed.
 --
 -- The problem in ticket #1433 was that the dependencies on the right-hand
 -- side of an IN operator were not being checked correctly.  So in an
@@ -26,12 +26,12 @@ test:plan(3)
 --
 -- the optimizer was missing the fact that the right-hand side of the IN
 -- depended on table t2.  It was checking dependencies based on the
--- Expr.pRight field rather than Expr.pList and Expr.pSelect.  
+-- Expr.pRight field rather than Expr.pList and Expr.pSelect.
 --
 -- Such a bug could be verifed using a less elaborate test case.  But
 -- this test case (from the original bug poster) exercises so many different
 -- parts of the system all at once, that it seemed like a good one to
--- include in the test suite. 
+-- include in the test suite.
 --
 -- NOTE:  Yes, in spite of the name of this file (tkt1443.test) this
 -- test is for ticket #1433 not #1443.  I mistyped the name when I was
diff --git a/test/sql-tap/tkt1444.test.lua b/test/sql-tap/tkt1444.test.lua
index 837edcfbe..8496ae8ed 100755
--- a/test/sql-tap/tkt1444.test.lua
+++ b/test/sql-tap/tkt1444.test.lua
@@ -16,7 +16,7 @@ test:plan(4)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1444 has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt1449.test.lua b/test/sql-tap/tkt1449.test.lua
index 3d402ba11..ef69b09ac 100755
--- a/test/sql-tap/tkt1449.test.lua
+++ b/test/sql-tap/tkt1449.test.lua
@@ -16,7 +16,7 @@ test:plan(3)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1449 has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt1473.test.lua b/test/sql-tap/tkt1473.test.lua
index 070ac43a9..eda493afe 100755
--- a/test/sql-tap/tkt1473.test.lua
+++ b/test/sql-tap/tkt1473.test.lua
@@ -16,7 +16,7 @@ test:plan(57)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1473 has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -101,7 +101,7 @@ test:do_execsql_test(
         SELECT 1 FROM t1 WHERE a=0 UNION ALL SELECT 2 FROM t1 WHERE b=0
     ]], {
         -- <tkt1473-1.8>
-        
+
         -- </tkt1473-1.8>
     })
 
@@ -111,7 +111,7 @@ test:do_execsql_test(
         SELECT 1 FROM t1 WHERE a=0 UNION SELECT 2 FROM t1 WHERE b=0
     ]], {
         -- <tkt1473-1.9>
-        
+
         -- </tkt1473-1.9>
     })
 
@@ -907,7 +907,7 @@ test:do_execsql_test(
         SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 2 FROM t2 WHERE y=2
     ]], {
         -- <tkt1473-8.1>
-        
+
         -- </tkt1473-8.1>
     })
 
diff --git a/test/sql-tap/tkt1501.test.lua b/test/sql-tap/tkt1501.test.lua
index 4b3e5de6e..37891d045 100755
--- a/test/sql-tap/tkt1501.test.lua
+++ b/test/sql-tap/tkt1501.test.lua
@@ -16,7 +16,7 @@ test:plan(1)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1501 is
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt1514.test.lua b/test/sql-tap/tkt1514.test.lua
index 6cfc9676b..4ad745281 100755
--- a/test/sql-tap/tkt1514.test.lua
+++ b/test/sql-tap/tkt1514.test.lua
@@ -16,7 +16,7 @@ test:plan(1)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1514 is
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt1537.test.lua b/test/sql-tap/tkt1537.test.lua
index e333ce9fa..e4d4064b1 100755
--- a/test/sql-tap/tkt1537.test.lua
+++ b/test/sql-tap/tkt1537.test.lua
@@ -16,7 +16,7 @@ test:plan(15)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1537 is
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt2141.test.lua b/test/sql-tap/tkt2141.test.lua
index f054d4502..eb3165144 100755
--- a/test/sql-tap/tkt2141.test.lua
+++ b/test/sql-tap/tkt2141.test.lua
@@ -16,7 +16,7 @@ test:plan(3)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #2141 has been
--- fixed.  
+-- fixed.
 --
 --
 -- $Id: tkt2141.test,v 1.2 2007/09/12 17:01:45 danielk1977 Exp $
diff --git a/test/sql-tap/tkt2192.test.lua b/test/sql-tap/tkt2192.test.lua
index 74ec19a63..365fddf15 100755
--- a/test/sql-tap/tkt2192.test.lua
+++ b/test/sql-tap/tkt2192.test.lua
@@ -17,7 +17,7 @@ test:plan(4)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #2192 has been
--- fixed.  
+-- fixed.
 --
 --
 -- $Id: tkt2192.test,v 1.3 2008/08/04 03:51:24 danielk1977 Exp $
@@ -92,7 +92,7 @@ test:do_execsql_test(
           select * from jan join nov on (jan.expense = nov.expense);
     ]], {
         -- <tkt2192-1.1>
-        
+
         -- </tkt2192-1.1>
     })
 
diff --git a/test/sql-tap/tkt2391.test.lua b/test/sql-tap/tkt2391.test.lua
index 1320d6490..3822adde5 100755
--- a/test/sql-tap/tkt2391.test.lua
+++ b/test/sql-tap/tkt2391.test.lua
@@ -26,7 +26,7 @@ test:do_execsql_test(
         INSERT INTO folders VALUES(4, 0, 'FolderC');
     ]], {
         -- <tkt2391.1>
-        
+
         -- </tkt2391.1>
     })
 
@@ -51,7 +51,7 @@ test:do_execsql_test(
     })
 
 -- This demonstrates the bug. Creating the index causes sql to ignore
--- the "COLLATE nocase" clause and use the default collation sequence 
+-- the "COLLATE nocase" clause and use the default collation sequence
 -- for column "foldername" instead (happens to be BINARY in this case).
 --
 test:do_execsql_test(
diff --git a/test/sql-tap/tkt2640.test.lua b/test/sql-tap/tkt2640.test.lua
index 5198eb183..4f0f2d1c3 100755
--- a/test/sql-tap/tkt2640.test.lua
+++ b/test/sql-tap/tkt2640.test.lua
@@ -18,7 +18,7 @@ test:plan(6)
 --
 -- $Id: tkt2640.test,v 1.3 2008/08/04 03:51:24 danielk1977 Exp $
 --
--- The problem in ticket #2640 was that the query optimizer was 
+-- The problem in ticket #2640 was that the query optimizer was
 -- not recognizing all uses of tables within subqueries in the
 -- WHERE clause.  If the subquery contained a compound SELECT,
 -- then tables that were used by terms of the compound other than
diff --git a/test/sql-tap/tkt2822.test.lua b/test/sql-tap/tkt2822.test.lua
index 3f67a0a74..602fed110 100755
--- a/test/sql-tap/tkt2822.test.lua
+++ b/test/sql-tap/tkt2822.test.lua
@@ -25,17 +25,17 @@ test:plan(30)
 
 
 -- The ORDER BY matching algorithm is three steps:
--- 
+--
 --   (1)  If the ORDER BY term is an integer constant i, then
 --        sort by the i-th column of the result set.
--- 
+--
 --   (2)  If the ORDER BY term is an identifier (not x.y or x.y.z
 --        but simply x) then look for a column alias with the same
 --        name.  If found, then sort by that column.
--- 
+--
 --   (3)  Evaluate the term as an expression and sort by the
 --        value of the expression.
--- 
+--
 -- For a compound SELECT the rules are modified slightly.
 -- In the third rule, the expression must exactly match one
 -- of the result columns.  The sequences of three rules is
@@ -51,7 +51,7 @@ test:plan(30)
 --
 -- Rule (2) was added by the changes ticket #2822.  Prior to
 -- that changes, sql did not support rule (2), making it
--- technically in violation of standard SQL semantics.  
+-- technically in violation of standard SQL semantics.
 -- No body noticed because rule (3) has the same effect as
 -- rule (2) except in some obscure cases.
 --
@@ -74,7 +74,7 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(6, 18, 54);
     ]], {
         -- <tkt2822-0.1>
-        
+
         -- </tkt2822-0.1>
     })
 
@@ -93,9 +93,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt2822-1.2",
     [[
-        SELECT a, CAST (b AS TEXT), c FROM t1 
-          UNION ALL 
-        SELECT a, b, c FROM t2 
+        SELECT a, CAST (b AS TEXT), c FROM t1
+          UNION ALL
+        SELECT a, b, c FROM t2
           ORDER BY 2;
     ]], {
         -- <tkt2822-1.2>
@@ -118,9 +118,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt2822-2.2",
     [[
-        SELECT a, CAST (b AS TEXT) AS x, c FROM t1 
-          UNION ALL 
-        SELECT a, b, c FROM t2 
+        SELECT a, CAST (b AS TEXT) AS x, c FROM t1
+          UNION ALL
+        SELECT a, b, c FROM t2
           ORDER BY x;
     ]], {
         -- <tkt2822-2.2>
@@ -143,9 +143,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt2822-3.1",
     [[
-        SELECT a, CAST (b AS TEXT) AS x, c FROM t1 
-          UNION ALL 
-        SELECT a, b, c FROM t2 
+        SELECT a, CAST (b AS TEXT) AS x, c FROM t1
+          UNION ALL
+        SELECT a, b, c FROM t2
           ORDER BY CAST (b AS TEXT);
     ]], {
         -- <tkt2822-3.1>
@@ -168,9 +168,9 @@ test:do_test(
     function()
         -- But the leftmost SELECT takes precedence.
         return test:execsql [[
-            SELECT a AS b, CAST (b AS TEXT) AS a, c FROM t1 
-              UNION ALL 
-            SELECT a, b, c FROM t2 
+            SELECT a AS b, CAST (b AS TEXT) AS a, c FROM t1
+              UNION ALL
+            SELECT a, b, c FROM t2
               ORDER BY a;
         ]]
     end, {
@@ -182,9 +182,9 @@ test:do_test(
 test:do_execsql_test(
     "tkt2822-3.5",
     [[
-        SELECT a, b, c FROM t2 
-          UNION ALL 
-        SELECT a AS b, CAST (b AS TEXT) AS a, c FROM t1 
+        SELECT a, b, c FROM t2
+          UNION ALL
+        SELECT a AS b, CAST (b AS TEXT) AS a, c FROM t1
           ORDER BY a;
     ]], {
         -- <tkt2822-3.5>
@@ -207,7 +207,7 @@ test:do_catchsql_test(
 -- Tests for rule (2).
 --
 -- The "ORDER BY b" should match the column alias (rule 2), not the
--- the t3.b value (rule 3).  
+-- the t3.b value (rule 3).
 --
 test:do_execsql_test(
     "tkt2822-5.1",
@@ -252,7 +252,7 @@ test:do_test(
 
 -- In "ORDER BY +b" the term is now an expression rather than
 -- a label.  It therefore matches by rule (3) instead of rule (2).
--- 
+--
 test:do_execsql_test(
     "tkt2822-5.5",
     [[
diff --git a/test/sql-tap/tkt2927.test.lua b/test/sql-tap/tkt2927.test.lua
index d51a228dd..acbb58a55 100755
--- a/test/sql-tap/tkt2927.test.lua
+++ b/test/sql-tap/tkt2927.test.lua
@@ -272,7 +272,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, b FROM t1
-            UNION 
+            UNION
             SELECT a, b FROM t1
             ORDER BY 1
         ]]
@@ -287,7 +287,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, b FROM t1
-            UNION 
+            UNION
             SELECT a, abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -302,7 +302,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, b FROM t1
-            UNION 
+            UNION
             SELECT abs(a), b FROM t1
             ORDER BY 1
         ]]
@@ -317,7 +317,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, b FROM t1
-            UNION 
+            UNION
             SELECT abs(a), abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -332,7 +332,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, abs(b) FROM t1
-            UNION 
+            UNION
             SELECT a, b FROM t1
             ORDER BY 1
         ]]
@@ -347,7 +347,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, abs(b) FROM t1
-            UNION 
+            UNION
             SELECT a, abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -362,7 +362,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, abs(b) FROM t1
-            UNION 
+            UNION
             SELECT abs(a), b FROM t1
             ORDER BY 1
         ]]
@@ -377,7 +377,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, abs(b) FROM t1
-            UNION 
+            UNION
             SELECT abs(a), abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -392,7 +392,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), b FROM t1
-            UNION 
+            UNION
             SELECT a, b FROM t1
             ORDER BY 1
         ]]
@@ -407,7 +407,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), b FROM t1
-            UNION 
+            UNION
             SELECT a, abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -422,7 +422,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), b FROM t1
-            UNION 
+            UNION
             SELECT abs(a), b FROM t1
             ORDER BY 1
         ]]
@@ -437,7 +437,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), b FROM t1
-            UNION 
+            UNION
             SELECT abs(a), abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -452,7 +452,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), abs(b) FROM t1
-            UNION 
+            UNION
             SELECT a, b FROM t1
             ORDER BY 1
         ]]
@@ -467,7 +467,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), abs(b) FROM t1
-            UNION 
+            UNION
             SELECT a, abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -482,7 +482,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), abs(b) FROM t1
-            UNION 
+            UNION
             SELECT abs(a), b FROM t1
             ORDER BY 1
         ]]
@@ -497,7 +497,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), abs(b) FROM t1
-            UNION 
+            UNION
             SELECT abs(a), abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -741,7 +741,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.1>
-        
+
         -- </tkt2927-5.1>
     })
 
@@ -755,7 +755,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.2>
-        
+
         -- </tkt2927-5.2>
     })
 
@@ -769,7 +769,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.3>
-        
+
         -- </tkt2927-5.3>
     })
 
@@ -783,7 +783,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.4>
-        
+
         -- </tkt2927-5.4>
     })
 
@@ -797,7 +797,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.5>
-        
+
         -- </tkt2927-5.5>
     })
 
@@ -811,7 +811,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.6>
-        
+
         -- </tkt2927-5.6>
     })
 
@@ -825,7 +825,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.7>
-        
+
         -- </tkt2927-5.7>
     })
 
@@ -839,7 +839,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.8>
-        
+
         -- </tkt2927-5.8>
     })
 
@@ -853,7 +853,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.9>
-        
+
         -- </tkt2927-5.9>
     })
 
@@ -867,7 +867,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.10>
-        
+
         -- </tkt2927-5.10>
     })
 
@@ -881,7 +881,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.11>
-        
+
         -- </tkt2927-5.11>
     })
 
@@ -895,7 +895,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.12>
-        
+
         -- </tkt2927-5.12>
     })
 
@@ -909,7 +909,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.13>
-        
+
         -- </tkt2927-5.13>
     })
 
@@ -923,7 +923,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.14>
-        
+
         -- </tkt2927-5.14>
     })
 
@@ -937,7 +937,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.15>
-        
+
         -- </tkt2927-5.15>
     })
 
@@ -951,7 +951,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.16>
-        
+
         -- </tkt2927-5.16>
     })
 
diff --git a/test/sql-tap/tkt2942.test.lua b/test/sql-tap/tkt2942.test.lua
index d6137a75a..2c06e013e 100755
--- a/test/sql-tap/tkt2942.test.lua
+++ b/test/sql-tap/tkt2942.test.lua
@@ -14,7 +14,7 @@ test:plan(4)
 --
 -------------------------------------------------------------------------
 --
--- Ticket #2942.  
+-- Ticket #2942.
 --
 -- Queries of the form:
 --
diff --git a/test/sql-tap/tkt3201.test.lua b/test/sql-tap/tkt3201.test.lua
index 065b088af..948606093 100755
--- a/test/sql-tap/tkt3201.test.lua
+++ b/test/sql-tap/tkt3201.test.lua
@@ -27,7 +27,7 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES(2, 'two');
     ]], {
         -- <tkt3201-1>
-        
+
         -- </tkt3201-1>
     })
 
@@ -104,7 +104,7 @@ test:do_test(
 test:do_execsql_test(
     "tkt3201-7",
     [[
-        SELECT a, b, c, d FROM t1, t3 WHERE a < c 
+        SELECT a, b, c, d FROM t1, t3 WHERE a < c
     ]], {
         -- <tkt3201-7>
         1, "one", 2, "two"
@@ -124,7 +124,7 @@ test:do_test(
             BEGIN
               INSERT INTO t4_log(x) VALUES(new.x);
             END;
-            CREATE TRIGGER r4_2 AFTER INSERT ON t4 FOR EACH ROW 
+            CREATE TRIGGER r4_2 AFTER INSERT ON t4 FOR EACH ROW
             WHEN new.x=2 BEGIN
               INSERT INTO t4_log(x) VALUES(new.x);
             END;
diff --git a/test/sql-tap/tkt3298.test.lua b/test/sql-tap/tkt3298.test.lua
index 270e4f1ff..2a4831ff9 100755
--- a/test/sql-tap/tkt3298.test.lua
+++ b/test/sql-tap/tkt3298.test.lua
@@ -13,7 +13,7 @@ test:plan(6)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- This file tests changes to the name resolution logic that occurred
 -- in august of 2008 and where associated with tickets #3298 and #3301
 --
diff --git a/test/sql-tap/tkt3357.test.lua b/test/sql-tap/tkt3357.test.lua
index 645d63a73..bcf49974c 100755
--- a/test/sql-tap/tkt3357.test.lua
+++ b/test/sql-tap/tkt3357.test.lua
@@ -31,14 +31,14 @@ test:do_execsql_test(
         insert into b values(1, 'btest');
     ]], {
         -- <tkt3357-1.1>
-        
+
         -- </tkt3357-1.1>
     })
 
 test:do_execsql_test(
     "tkt3357-1.2",
     [[
-        SELECT cc.id, cc.b_id, cc.myvalue, dd.bvalue 
+        SELECT cc.id, cc.b_id, cc.myvalue, dd.bvalue
         FROM (
           SELECT DISTINCT a.id, a.b_id, a.myvalue FROM a
           INNER JOIN b ON a.b_id = b.id WHERE b.bvalue = 'btest'
@@ -55,7 +55,7 @@ test:do_execsql_test(
     [[
         SELECT cc.id, cc.b_id, cc.myvalue
         FROM (
-          SELECT a.id, a.b_id, a.myvalue 
+          SELECT a.id, a.b_id, a.myvalue
           FROM a, b WHERE a.b_id = b.id
         ) cc
         LEFT OUTER JOIN b dd ON cc.b_id = dd.id
@@ -70,7 +70,7 @@ test:do_execsql_test(
     [[
         SELECT cc.id, cc.b_id, cc.myvalue
         FROM (
-          SELECT DISTINCT a.id, a.b_id, a.myvalue 
+          SELECT DISTINCT a.id, a.b_id, a.myvalue
           FROM a, b WHERE a.b_id = b.id
         ) cc
         LEFT OUTER JOIN b dd ON cc.b_id = dd.id
diff --git a/test/sql-tap/tkt3424.test.lua b/test/sql-tap/tkt3424.test.lua
index 5e19936c0..5d7d30bff 100755
--- a/test/sql-tap/tkt3424.test.lua
+++ b/test/sql-tap/tkt3424.test.lua
@@ -33,14 +33,14 @@ test:do_execsql_test(
         INSERT INTO orig VALUES(5, 'AAA','E5');
     ]], {
         -- <tkt3424-1.1>
-        
+
         -- </tkt3424-1.1>
     })
 
 test:do_execsql_test(
     "tkt3424-1.2",
     [[
-        SELECT names.id,names.data,names.code,orig.code,orig.data FROM 
+        SELECT names.id,names.data,names.code,orig.code,orig.data FROM
         names LEFT OUTER JOIN orig
         ON names.data = orig.data AND names.code = orig.code;
     ]], {
@@ -52,17 +52,17 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3424-1.3",
     [[
-        CREATE INDEX udx_orig_code_data ON orig(code, data) 
+        CREATE INDEX udx_orig_code_data ON orig(code, data)
     ]], {
         -- <tkt3424-1.3>
-        
+
         -- </tkt3424-1.3>
     })
 
 test:do_execsql_test(
     "tkt3424-1.4",
     [[
-        SELECT names.id,names.data,names.code,orig.code,orig.data FROM 
+        SELECT names.id,names.data,names.code,orig.code,orig.data FROM
         names LEFT OUTER JOIN orig
         ON names.data = orig.data AND names.code = orig.code;
     ]], {
diff --git a/test/sql-tap/tkt3442.test.lua b/test/sql-tap/tkt3442.test.lua
index 5f9dc3b5a..41856864d 100755
--- a/test/sql-tap/tkt3442.test.lua
+++ b/test/sql-tap/tkt3442.test.lua
@@ -16,7 +16,7 @@ test:plan(4)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #3442 has been
--- fixed.  
+-- fixed.
 --
 --
 -- $Id: tkt3442.test,v 1.2 2009/06/05 17:09:12 drh Exp $
@@ -35,7 +35,7 @@ test:do_execsql_test(
         CREATE UNIQUE INDEX ididx ON listhash(id);
     ]], {
         -- <tkt3442-1.1>
-        
+
         -- </tkt3442-1.1>
     })
 
diff --git a/test/sql-tap/tkt3493.test.lua b/test/sql-tap/tkt3493.test.lua
index 9387c5207..0aac0ddb9 100755
--- a/test/sql-tap/tkt3493.test.lua
+++ b/test/sql-tap/tkt3493.test.lua
@@ -36,20 +36,20 @@ test:do_execsql_test(
         COMMIT;
     ]], {
         -- <tkt3493-1.1>
-        
+
         -- </tkt3493-1.1>
     })
 
 test:do_execsql_test(
     "tkt3493-1.2",
     [[
-        SELECT 
-          CASE 
-             WHEN B.val = 1 THEN 'XYZ' 
-             ELSE A.val 
+        SELECT
+          CASE
+             WHEN B.val = 1 THEN 'XYZ'
+             ELSE A.val
           END AS Col1
-        FROM B  
-        LEFT OUTER JOIN A_B ON B.id = A_B.B_id  
+        FROM B
+        LEFT OUTER JOIN A_B ON B.id = A_B.B_id
         LEFT OUTER JOIN A ON A.id = A_B.A_id
         ORDER BY Col1 ASC;
     ]], {
@@ -62,12 +62,12 @@ test:do_execsql_test(
     "tkt3493-1.3",
     [[
         SELECT DISTINCT
-          CASE 
-             WHEN B.val = 1 THEN 'XYZ' 
-             ELSE A.val 
+          CASE
+             WHEN B.val = 1 THEN 'XYZ'
+             ELSE A.val
           END AS Col1
-        FROM B  
-        LEFT OUTER JOIN A_B ON B.id = A_B.B_id  
+        FROM B
+        LEFT OUTER JOIN A_B ON B.id = A_B.B_id
         LEFT OUTER JOIN A ON A.id = A_B.A_id
         ORDER BY Col1 ASC;
     ]], {
@@ -89,9 +89,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-1.5",
     [[
-        SELECT DISTINCT 
-          b.val, 
-          CASE WHEN b.val = 1 THEN 'xyz' ELSE b.val END AS col1 
+        SELECT DISTINCT
+          b.val,
+          CASE WHEN b.val = 1 THEN 'xyz' ELSE b.val END AS col1
         FROM b;
     ]], {
         -- <tkt3493-1.5>
@@ -102,9 +102,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-1.6",
     [[
-        SELECT DISTINCT 
-          b.val, 
-          CASE WHEN b.val = '1' THEN 'xyz' ELSE b.val END AS col1 
+        SELECT DISTINCT
+          b.val,
+          CASE WHEN b.val = '1' THEN 'xyz' ELSE b.val END AS col1
         FROM b;
     ]], {
         -- <tkt3493-1.6>
@@ -119,14 +119,14 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES('123', 456);
     ]], {
         -- <tkt3493-2.1>
-        
+
         -- </tkt3493-2.1>
     })
 
 test:do_execsql_test(
     "tkt3493-2.2.1",
     [[
-        SELECT a=123 FROM t1 GROUP BY a 
+        SELECT a=123 FROM t1 GROUP BY a
     ]], {
         -- <tkt3493-2.2.1>
         true
@@ -136,7 +136,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.2.2",
     [[
-        SELECT a=123 FROM t1 
+        SELECT a=123 FROM t1
     ]], {
         -- <tkt3493-2.2.2>
         true
@@ -146,7 +146,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.2.3",
     [[
-        SELECT a='123' FROM t1 
+        SELECT a='123' FROM t1
     ]], {
         -- <tkt3493-2.2.3>
         true
@@ -156,7 +156,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.2.4",
     [[
-        SELECT count(*), a=123 FROM t1 
+        SELECT count(*), a=123 FROM t1
     ]], {
         -- <tkt3493-2.2.4>
         1, true
@@ -166,7 +166,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.2.5",
     [[
-        SELECT count(*), +a=123 FROM t1 
+        SELECT count(*), +a=123 FROM t1
     ]], {
         -- <tkt3493-2.2.5>
         1, true
@@ -176,7 +176,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.3.3",
     [[
-        SELECT b='456' FROM t1 GROUP BY a 
+        SELECT b='456' FROM t1 GROUP BY a
     ]], {
         -- <tkt3493-2.3.3>
         true
@@ -186,7 +186,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.3.1",
     [[
-        SELECT b='456' FROM t1 GROUP BY b 
+        SELECT b='456' FROM t1 GROUP BY b
     ]], {
         -- <tkt3493-2.3.1>
         true
@@ -196,7 +196,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.3.2",
     [[
-        SELECT b='456' FROM t1 
+        SELECT b='456' FROM t1
     ]], {
         -- <tkt3493-2.3.2>
         true
@@ -206,7 +206,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.4.1",
     [[
-        SELECT typeof(a), a FROM t1 GROUP BY a HAVING a=123 
+        SELECT typeof(a), a FROM t1 GROUP BY a HAVING a=123
     ]], {
         -- <tkt3493-2.4.1>
         "string", "123"
@@ -216,7 +216,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.4.2",
     [[
-        SELECT typeof(a), a FROM t1 GROUP BY b HAVING a=123 
+        SELECT typeof(a), a FROM t1 GROUP BY b HAVING a=123
     ]], {
         -- <tkt3493-2.4.2>
         "string", "123"
@@ -226,7 +226,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.5.1",
     [[
-        SELECT typeof(b), b FROM t1 GROUP BY a HAVING b='456' 
+        SELECT typeof(b), b FROM t1 GROUP BY a HAVING b='456'
     ]], {
         -- <tkt3493-2.5.1>
         "integer", 456
@@ -236,7 +236,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.5.2",
     [[
-        SELECT typeof(b), b FROM t1 GROUP BY b HAVING b='456' 
+        SELECT typeof(b), b FROM t1 GROUP BY b HAVING b='456'
     ]], {
         -- <tkt3493-2.5.2>
         "integer", 456
@@ -250,7 +250,7 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES('aBc', 'DeF');
     ]], {
         -- <tkt3493-3.1>
-        
+
         -- </tkt3493-3.1>
     })
 
@@ -258,7 +258,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-3.2.1",
     [[
-        SELECT a='abc' FROM t2 GROUP BY a 
+        SELECT a='abc' FROM t2 GROUP BY a
     ]], {
         -- <tkt3493-3.2.1>
         true
@@ -268,7 +268,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-3.2.2",
     [[
-        SELECT a='abc' FROM t2 
+        SELECT a='abc' FROM t2
     ]], {
         -- <tkt3493-3.2.2>
         true
diff --git a/test/sql-tap/tkt3554.test.lua b/test/sql-tap/tkt3554.test.lua
index c213f5808..1c7253128 100755
--- a/test/sql-tap/tkt3554.test.lua
+++ b/test/sql-tap/tkt3554.test.lua
@@ -16,7 +16,7 @@ test:plan(4)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #3554 has been
--- fixed.  
+-- fixed.
 --
 -- $Id: tkt3554.test,v 1.2 2009/06/05 17:09:12 drh Exp $
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/tkt3581.test.lua b/test/sql-tap/tkt3581.test.lua
index 2e079d270..0cd11a77d 100755
--- a/test/sql-tap/tkt3581.test.lua
+++ b/test/sql-tap/tkt3581.test.lua
@@ -16,7 +16,7 @@ test:plan(3)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #3581 has been
--- fixed.  
+-- fixed.
 --
 -- $Id: tkt3581.test,v 1.1 2009/01/14 01:10:40 drh Exp $
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
@@ -34,7 +34,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt3581-1.1>
-        
+
         -- </tkt3581-1.1>
     })
 
diff --git a/test/sql-tap/tkt3935.test.lua b/test/sql-tap/tkt3935.test.lua
index 7138e9e6a..f3bbe0b9f 100755
--- a/test/sql-tap/tkt3935.test.lua
+++ b/test/sql-tap/tkt3935.test.lua
@@ -27,30 +27,31 @@ test:do_execsql_test(
         CREATE TABLE t2(c INT primary key, d INT);
     ]], {
         -- <tkt3935.1>
-        
+
         -- </tkt3935.1>
     })
 
 test:do_execsql_test(
     "tkt3935.2",
     [[
-        SELECT j1.b FROM ( SELECT * FROM t1 INNER JOIN t2 ON a=c ) AS j1 
+        SELECT j1.b FROM ( SELECT * FROM t1 INNER JOIN t2 ON a=c ) AS j1
     ]], {
         -- <tkt3935.2>
-        
+
         -- </tkt3935.2>
     })
 
 test:do_execsql_test(
     "tkt3935.3",
     [[
-        SELECT j1.b FROM (t1 INNER JOIN t2 ON a=c) AS j1 
+        SELECT j1.b FROM (t1 INNER JOIN t2 ON a=c) AS j1
     ]], {
         -- <tkt3935.3>
-        
+
         -- </tkt3935.3>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.4",
     [[
@@ -61,6 +62,7 @@ test:do_catchsql_test(
         -- </tkt3935.4>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.5",
     [[
@@ -71,6 +73,7 @@ test:do_catchsql_test(
         -- </tkt3935.5>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.6",
     [[
@@ -81,6 +84,7 @@ test:do_catchsql_test(
         -- </tkt3935.6>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.7",
     [[
@@ -91,6 +95,7 @@ test:do_catchsql_test(
         -- </tkt3935.7>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.8",
     [[
@@ -101,6 +106,7 @@ test:do_catchsql_test(
         -- </tkt3935.8>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.9",
     [[
@@ -111,6 +117,7 @@ test:do_catchsql_test(
         -- </tkt3935.9>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.10",
     [[
diff --git a/test/sql-tap/tokenize.test.lua b/test/sql-tap/tokenize.test.lua
index 8d19a507c..1c15b2abf 100755
--- a/test/sql-tap/tokenize.test.lua
+++ b/test/sql-tap/tokenize.test.lua
@@ -152,7 +152,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "tokenize-2.2",
     [[
-        SELECT 1, 2 /* 
+        SELECT 1, 2 /*
     ]], {
         -- <tokenize-2.2>
         0, {1, 2}
diff --git a/test/sql-tap/transitive1.test.lua b/test/sql-tap/transitive1.test.lua
index af65dc518..dbc2559fa 100755
--- a/test/sql-tap/transitive1.test.lua
+++ b/test/sql-tap/transitive1.test.lua
@@ -343,7 +343,7 @@ test:do_execsql_test(
                    ON files.idpath = path.idpath
                  LEFT JOIN bookmark
                         ON bookmark.idfile = episode.idfile
-                           AND bookmark.type = 1; 
+                           AND bookmark.type = 1;
         CREATE VIEW tvshowview
         AS
           SELECT tvshow.*,
@@ -362,7 +362,7 @@ test:do_execsql_test(
                         ON episode.idshow = tvshow.idshow
                  LEFT JOIN files
                         ON files.idfile = episode.idfile
-          GROUP  BY tvshow.idshow; 
+          GROUP  BY tvshow.idshow;
         SELECT
           episodeview.c12,
           path.strPath,
diff --git a/test/sql-tap/triggerB.test.lua b/test/sql-tap/triggerB.test.lua
index 55b3bc32f..7500ac9f6 100755
--- a/test/sql-tap/triggerB.test.lua
+++ b/test/sql-tap/triggerB.test.lua
@@ -41,7 +41,7 @@ test:do_execsql_test(
         -- </triggerB-1.1>
     })
 
--- MUST_WORK_TEST 
+-- MUST_WORK_TEST
 -- do_test triggerB-1.2 {
 --   execsql {
 --     UPDATE vx SET y = yy;
@@ -153,7 +153,7 @@ test:do_test(
             );
         ]]
         -- for _ in X(0, "X!for", [=[["set i 0","$i<=65","incr i"]]=]) do
-        for i=0,65 do    
+        for i=0,65 do
             local sql = string.format([[
                     CREATE TRIGGER t3c%s AFTER UPDATE ON t3
                     FOR EACH ROW
@@ -169,15 +169,15 @@ test:do_test(
         ]]
     end, {
         -- <triggerB-3.1>
-        
+
         -- </triggerB-3.1>
     })
 
 -- for _ in X(0, "X!for", [=[["set i 0","$i<=64","incr i"]]=]) do
-for i=0,64 do    
+for i=0,64 do
 --    X(139, "X!cmd", [=[["do_test",["triggerB-3.2.",["i"],".1"],["\n    execsql {\n      UPDATE t3 SET c",["i"],"='b",["i"],"';\n      SELECT * FROM t3_changes ORDER BY colnum DESC LIMIT 1;\n    }\n  "],[["i"]," a",["i"]," b",["i"]]]]=])
     test:do_execsql_test("triggerB-3.2."..i..".1",
-                         string.format([[UPDATE t3 SET c%d='b%d'; 
+                         string.format([[UPDATE t3 SET c%d='b%d';
                                          SELECT * FROM t3_changes ORDER BY colnum DESC LIMIT 1; ]],
                                        i, i),
                          {i, string.format("a%d", i), string.format("b%d", i)})
diff --git a/test/sql-tap/types2.test.lua b/test/sql-tap/types2.test.lua
index 04ed3070d..e5df78b9e 100755
--- a/test/sql-tap/types2.test.lua
+++ b/test/sql-tap/types2.test.lua
@@ -199,7 +199,7 @@ test_bool("types2-4.26", "o1='500'", "'500' > o1", 0)
 test_bool("types2-4.27", "o1='500'", "500.0 > o1", 0)
 test_bool("types2-4.28", "o1='500'", "'500.0' > o1", 1)
 -- types2-5.* - The 'IN (x, y....)' operator with no index.
--- 
+--
 -- Compare literals against literals (no affinity applied)
 test_bool("types2-5.1", "", "(NULL IN ('10.0', 20)) IS NULL", 1)
 test_bool("types2-5.2", "", "10 IN ('10.0', 20)", 0)
@@ -254,9 +254,9 @@ test_bool("types2-5.43", "t1='010',n1=10", "n1 IN (5,t1,11)", 1)
 
 
 -- Tests named types2-6.* use the same infrastructure as the types2-2.*
--- tests. The contents of the vals array is repeated here for easy 
+-- tests. The contents of the vals array is repeated here for easy
 -- reference.
--- 
+--
 -- set vals [list 10 10.0 '10' '10.0' 20 20.0 '20' '20.0' 30 30.0 '30' '30.0']
 --                1  2    3    4      5  6    7    8      9  10   11   12
 test_boolset("types2-6.1", "o IN ('10', 30)", {3, 9, 10})
@@ -271,7 +271,7 @@ test_boolset("types2-6.8", "i IN (20.0, 30.0)", {5, 6, 7, 8, 9, 10, 11, 12})
 test_boolset("types2-6.9", "id IN (1, 6, 10)", {1, 6, 10})
 
 
--- Tests types2-7.* concentrate on expressions of the form 
+-- Tests types2-7.* concentrate on expressions of the form
 -- "x IN (SELECT...)" with no index.
 test:execsql [[
     CREATE TABLE t3(id  INT primary key, i INTEGER, n NUMERIC, t TEXT, o SCALAR);
diff --git a/test/sql-tap/update.test.lua b/test/sql-tap/update.test.lua
index ac6ee8803..dca086884 100755
--- a/test/sql-tap/update.test.lua
+++ b/test/sql-tap/update.test.lua
@@ -46,7 +46,7 @@ test:do_catchsql_test("update-1.1", [[
 test:do_test("update-3.1", function()
   test:execsql "CREATE TABLE test1(id  INT primary key, f1 int,f2 int)"
   -- for _ in X(0, "X!for", [=[["set i 1","$i<=10","incr i"]]=]) do
-  for i = 1, 10 do    
+  for i = 1, 10 do
     local sql = string.format("INSERT INTO test1 VALUES(%s,%s,%s)", i, i, bit.lshift(1, i)) -- X(0, "X!expr", [=[["<<",1,["i"]]]=]))
     test:execsql(sql)
   end
@@ -89,7 +89,7 @@ test:do_execsql_test("update-3.5", [[
   UPDATE test1 SET f2=f2*3
 ]], {
   -- <update-3.5>
-  
+
   -- </update-3.5>
 })
 
@@ -182,7 +182,7 @@ test:do_test("update-3.13", function()
   return test:execsql "UPDATE test1 SET F2=f1, F1=f2"
 end, {
   -- <update-3.13>
-  
+
   -- </update-3.13>
 })
 
@@ -348,7 +348,7 @@ test:do_execsql_test("update-5.5", [[
   UPDATE test1 SET f1=f1-1 WHERE f1>100 and f2==128
 ]], {
   -- <update-5.5>
-  
+
   -- </update-5.5>
 })
 
@@ -372,7 +372,7 @@ test:do_execsql_test("update-5.5.3", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-5.5.3>
-  
+
   -- </update-5.5.3>
 })
 
@@ -420,7 +420,7 @@ test:do_execsql_test("update-5.6.3", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-5.6.3>
-  
+
   -- </update-5.6.3>
 })
 
@@ -482,7 +482,7 @@ test:do_execsql_test("update-6.1.3", [[
   SELECT f1,f2 FROM test1 WHERE f1==88 ORDER BY f1,f2
 ]], {
   -- <update-6.1.3>
-  
+
   -- </update-6.1.3>
 })
 
@@ -516,7 +516,7 @@ test:do_execsql_test("update-6.3.2", [[
   SELECT f1,f2 FROM test1 WHERE f2==89 ORDER BY f1,f2
 ]], {
   -- <update-6.3.2>
-  
+
   -- </update-6.3.2>
 })
 
@@ -582,7 +582,7 @@ test:do_execsql_test("update-6.5.2", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-6.5.2>
-  
+
   -- </update-6.5.2>
 })
 
@@ -623,7 +623,7 @@ test:do_execsql_test("update-6.6.2", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-6.6.2>
-  
+
   -- </update-6.6.2>
 })
 
@@ -685,7 +685,7 @@ test:do_execsql_test("update-7.1.3", [[
   SELECT f1,f2 FROM test1 WHERE f1==88 ORDER BY f1,f2
 ]], {
   -- <update-7.1.3>
-  
+
   -- </update-7.1.3>
 })
 
@@ -720,7 +720,7 @@ test:do_execsql_test("update-7.3.2", [[
   SELECT f1,f2 FROM test1 WHERE f2==89 ORDER BY f1,f2
 ]], {
   -- <update-7.3.2>
-  
+
   -- </update-7.3.2>
 })
 
@@ -786,7 +786,7 @@ test:do_execsql_test("update-7.5.2", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-7.5.2>
-  
+
   -- </update-7.5.2>
 })
 
@@ -827,7 +827,7 @@ test:do_execsql_test("update-7.6.2", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-7.6.2>
-  
+
   -- </update-7.6.2>
 })
 
diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua
index 67f461132..f43fccb6b 100755
--- a/test/sql-tap/view.test.lua
+++ b/test/sql-tap/view.test.lua
@@ -32,7 +32,7 @@ test:plan(83)
 --     SELECT * FROM t1;
 --   }
 -- } {1 2 3 4 5 6 7 8 9}
--- 
+--
 test:do_execsql_test(
     "view-1.0",
     [[
@@ -232,7 +232,7 @@ test:do_execsql_test(
         -- </view-2.6>
     })
 
--- 
+--
 -- Test that column name of views are generated correctly.
 --
 test:do_execsql2_test(
@@ -1024,7 +1024,7 @@ test:do_execsql_test(
         CREATE VIEW v10 AS SELECT c1 FROM (SELECT t10.c1 FROM t10);
     ]], {
         -- <view-20.1>
-        
+
         -- </view-20.1>
     })
 
@@ -1037,7 +1037,7 @@ test:do_execsql_test(
         CREATE VIEW v10 AS SELECT c1 FROM (SELECT t10.c1 FROM t10);
     ]], {
         -- <view-20.1>
-        
+
         -- </view-20.1>
     })
 
diff --git a/test/sql-tap/where2.test.lua b/test/sql-tap/where2.test.lua
index db7edd539..58b795cd2 100755
--- a/test/sql-tap/where2.test.lua
+++ b/test/sql-tap/where2.test.lua
@@ -53,7 +53,7 @@ test:do_test(
         ]]
     end, {
         -- <where2-1.0>
-        
+
         -- </where2-1.0>
     })
 
@@ -80,7 +80,7 @@ end
 -- it appends the name of the table and index used.
 --
 
--- This procedure executes the SQL.  Then it appends 
+-- This procedure executes the SQL.  Then it appends
 -- the names of the table and index used
 --
 local function queryplan(sql)
@@ -899,7 +899,7 @@ test:do_test(
         "where2-7.4",
         function()
             test:execsql('create unique index i9y on t9(y);')
-            return cksort([[                   
+            return cksort([[
                    select * from t8, t9 where a=1 and y=3 order by b, x]])
         end, {
             -- <where2-7.4>
@@ -924,7 +924,7 @@ test:do_execsql_test(
         SELECT * FROM t1 WHERE x IN (20,21) AND y IN (1,2)
     ]], {
         -- <where2-8.1>
-        
+
         -- </where2-8.1>
     })
 
@@ -934,7 +934,7 @@ test:do_execsql_test(
         SELECT * FROM t1 WHERE x IN (1,2) AND y IN (-5,-6)
     ]], {
         -- <where2-8.2>
-        
+
         -- </where2-8.2>
     })
 
@@ -1031,7 +1031,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 2 AND 4)
     ]], {
         -- <where2-8.9>
-        
+
         -- </where2-8.9>
     })
 
@@ -1044,7 +1044,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.10>
-        
+
         -- </where2-8.10>
     })
 
@@ -1057,7 +1057,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.11>
-        
+
         -- </where2-8.11>
     })
 
@@ -1070,7 +1070,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN -4 AND -2)
     ]], {
         -- <where2-8.12>
-        
+
         -- </where2-8.12>
     })
 
@@ -1083,7 +1083,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.13>
-        
+
         -- </where2-8.13>
     })
 
@@ -1096,7 +1096,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.14>
-        
+
         -- </where2-8.14>
     })
 
@@ -1109,7 +1109,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 200 AND 300)
     ]], {
         -- <where2-8.15>
-        
+
         -- </where2-8.15>
     })
 
@@ -1122,7 +1122,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.16>
-        
+
         -- </where2-8.16>
     })
 
@@ -1135,7 +1135,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.17>
-        
+
         -- </where2-8.17>
     })
 
@@ -1148,7 +1148,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE +w BETWEEN 200 AND 300)
     ]], {
         -- <where2-8.18>
-        
+
         -- </where2-8.18>
     })
 
@@ -1161,7 +1161,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE +w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.19>
-        
+
         -- </where2-8.19>
     })
 
@@ -1174,7 +1174,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE +w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.20>
-        
+
         -- </where2-8.20>
     })
 
diff --git a/test/sql-tap/where3.test.lua b/test/sql-tap/where3.test.lua
index bc6e8108e..9b2bc2e25 100755
--- a/test/sql-tap/where3.test.lua
+++ b/test/sql-tap/where3.test.lua
@@ -113,7 +113,7 @@ test:do_test(
 
 
 
--- This procedure executes the SQL.  Then it appends 
+-- This procedure executes the SQL.  Then it appends
 -- the names of the table and index used
 --
 local function queryplan(sql)
@@ -158,8 +158,8 @@ local function queryplan(sql)
 end
 
 -- If you have a from clause of the form:   A B C left join D
--- then make sure the query optimizer is able to reorder the 
--- A B C part anyway it wants. 
+-- then make sure the query optimizer is able to reorder the
+-- A B C part anyway it wants.
 --
 -- Following the fix to ticket #1652, there was a time when
 -- the C table would not reorder.  So the following reorderings
@@ -344,7 +344,7 @@ test:do_test(
 -- If the outer loop must be a full table scan, do not let ANALYZE trick
 -- the planner into use a table for the outer loop that might be indexable
 -- if held until an inner loop.
--- 
+--
 test:do_execsql_test(
     "where3-3.0",
     [[
@@ -357,7 +357,7 @@ test:do_execsql_test(
         SELECT * FROM t302, t301 WHERE t302.x=5 AND t301.a=t302.y;
     ]], {
         -- <where3-3.0>
-        
+
         -- </where3-3.0>
     })
 
@@ -367,7 +367,7 @@ test:do_execsql_test(
         SELECT * FROM t301, t302 WHERE t302.x=5 AND t301.a=t302.y;
     ]], {
         -- <where3-3.1>
-        
+
         -- </where3-3.1>
     })
 
@@ -377,7 +377,7 @@ test:do_execsql_test(
         SELECT * FROM t301 WHERE c=3 AND a IS NULL;
     ]], {
         -- <where3-3.2>
-        
+
         -- </where3-3.2>
     })
 
@@ -459,55 +459,55 @@ test:do_execsql_test(
         CREATE INDEX bbb_222 ON bbb (parent, position);
         CREATE INDEX bbb_333 ON bbb (fk, lastModified);
 
-         SELECT bbb.title AS tag_title 
-           FROM aaa JOIN bbb ON bbb.id = aaa.parent  
+         SELECT bbb.title AS tag_title
+           FROM aaa JOIN bbb ON bbb.id = aaa.parent
           WHERE aaa.fk = 'constant'
             AND LENGTH(bbb.title) > 0
             AND bbb.parent = 4
           ORDER BY bbb.title COLLATE "unicode_ci" ASC;
     ]], {
         -- <where3-5.0>
-        
+
         -- </where3-5.0>
     })
 
 -- do_execsql_test where3-5.1 {
 --   EXPLAIN QUERY PLAN
---    SELECT bbb.title AS tag_title 
---      FROM aaa JOIN aaa AS bbb ON bbb.id = aaa.parent  
+--    SELECT bbb.title AS tag_title
+--      FROM aaa JOIN aaa AS bbb ON bbb.id = aaa.parent
 --     WHERE aaa.fk = 'constant'
 --       AND LENGTH(bbb.title) > 0
 --       AND bbb.parent = 4
 --     ORDER BY bbb.title COLLATE NOCASE ASC;
 -- } {
---   0 0 0 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)} 
---   0 1 1 {SEARCH TABLE aaa AS bbb USING INTEGER PRIMARY KEY (rowid=?)} 
+--   0 0 0 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)}
+--   0 1 1 {SEARCH TABLE aaa AS bbb USING INTEGER PRIMARY KEY (rowid=?)}
 --   0 0 0 {USE TEMP B-TREE FOR ORDER BY}
 -- }
 -- do_execsql_test where3-5.2 {
 --   EXPLAIN QUERY PLAN
---    SELECT bbb.title AS tag_title 
---      FROM bbb JOIN aaa ON bbb.id = aaa.parent  
+--    SELECT bbb.title AS tag_title
+--      FROM bbb JOIN aaa ON bbb.id = aaa.parent
 --     WHERE aaa.fk = 'constant'
 --       AND LENGTH(bbb.title) > 0
 --       AND bbb.parent = 4
 --     ORDER BY bbb.title COLLATE NOCASE ASC;
 -- } {
---   0 0 1 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)} 
---   0 1 0 {SEARCH TABLE bbb USING INTEGER PRIMARY KEY (rowid=?)} 
+--   0 0 1 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)}
+--   0 1 0 {SEARCH TABLE bbb USING INTEGER PRIMARY KEY (rowid=?)}
 --   0 0 0 {USE TEMP B-TREE FOR ORDER BY}
 -- }
 -- do_execsql_test where3-5.3 {
 --   EXPLAIN QUERY PLAN
---    SELECT bbb.title AS tag_title 
---      FROM aaa AS bbb JOIN aaa ON bbb.id = aaa.parent  
+--    SELECT bbb.title AS tag_title
+--      FROM aaa AS bbb JOIN aaa ON bbb.id = aaa.parent
 --     WHERE aaa.fk = 'constant'
 --       AND LENGTH(bbb.title) > 0
 --       AND bbb.parent = 4
 --     ORDER BY bbb.title COLLATE NOCASE ASC;
 -- } {
---   0 0 1 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)} 
---   0 1 0 {SEARCH TABLE aaa AS bbb USING INTEGER PRIMARY KEY (rowid=?)} 
+--   0 0 1 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)}
+--   0 1 0 {SEARCH TABLE aaa AS bbb USING INTEGER PRIMARY KEY (rowid=?)}
 --   0 0 0 {USE TEMP B-TREE FOR ORDER BY}
 -- }
 -- Name resolution with NATURAL JOIN and USING
@@ -535,7 +535,7 @@ test:do_test(
         ]]
     end, {
         -- <where3-6.setup>
-        
+
         -- </where3-6.setup>
     })
 
@@ -649,7 +649,7 @@ test:do_execsql_test(
         INSERT INTO t74 VALUES(234,678);
     ]], {
         -- <where3-7-setup>
-        
+
         -- </where3-7-setup>
     })
 
@@ -671,7 +671,7 @@ local disabled_opt = "none"
         [[
             SELECT x1 FROM t71 LEFT JOIN t72 ON x2=y1 WHERE y2 IS NULL;
         ]], {
-            
+
         })
 
     test:do_execsql_test(
diff --git a/test/sql-tap/where4.test.lua b/test/sql-tap/where4.test.lua
index 8eae3dc2c..1467faa9b 100755
--- a/test/sql-tap/where4.test.lua
+++ b/test/sql-tap/where4.test.lua
@@ -171,7 +171,7 @@ test:do_execsql_test(
           WHERE +t2.col1 IS NULL;
     ]], {
         -- <where4-4.1>
-        
+
         -- </where4-4.1>
     })
 
@@ -182,7 +182,7 @@ test:do_execsql_test(
           WHERE t2.col1 IS NULL;
     ]], {
         -- <where4-4.2>
-        
+
         -- </where4-4.2>
     })
 
@@ -193,7 +193,7 @@ test:do_execsql_test(
           WHERE +t1.col1 IS NULL;
     ]], {
         -- <where4-4.3>
-        
+
         -- </where4-4.3>
     })
 
@@ -204,7 +204,7 @@ test:do_execsql_test(
           WHERE t1.col1 IS NULL;
     ]], {
         -- <where4-4.4>
-        
+
         -- </where4-4.4>
     })
 
@@ -227,7 +227,7 @@ test:do_execsql_test(
                   LEFT JOIN t4 b2 ON b2.x=b1.x AND b2.y IN (b1.y);
     ]], {
         -- <where4-5.2>
-        1, '', '', '', '', '', '', 2, '', '', '', '', '', '', 3, '', '', '', '', '', '' 
+        1, '', '', '', '', '', '', 2, '', '', '', '', '', '', 3, '', '', '', '', '', ''
         -- </where4-5.2>
     })
 
@@ -242,7 +242,7 @@ test:do_execsql_test(
         INSERT INTO t4 VALUES(2,2,22);
     ]], {
         -- <where4-5.2>
-        
+
         -- </where4-5.2>
     })
 
@@ -281,7 +281,7 @@ test:do_test(
         ]]
     end, {
         -- <where4-7.1>
-        
+
         -- </where4-7.1>
     })
 
@@ -303,7 +303,7 @@ test:do_test(
 --   }
 -- } {}
 -- # At one point the sub-select inside the aggregate sum() function in the
--- # following query was leaking a couple of stack entries. This query 
+-- # following query was leaking a couple of stack entries. This query
 -- # runs the SELECT in a loop enough times that an assert() fails. Or rather,
 -- # did fail before the bug was fixed.
 -- #
diff --git a/test/sql-tap/where6.test.lua b/test/sql-tap/where6.test.lua
index f9de30dbc..5c5377f9c 100755
--- a/test/sql-tap/where6.test.lua
+++ b/test/sql-tap/where6.test.lua
@@ -85,10 +85,10 @@ test:do_test(
     function()
         -- return X(58, "X!cmd", [=[["explain_no_trace","SELECT * FROM t1 LEFT JOIN t2 ON x=b WHERE 1=c"]]=])
         return test:explain_no_trace('SELECT * FROM t1 LEFT JOIN t2 ON x=b WHERE 1=c')
-    end, 
+    end,
     -- <where6-1.6>
     -- X(57, "X!cmd", [=[["explain_no_trace","SELECT * FROM t1 LEFT JOIN t2 ON b=x WHERE c=1"]]=])
-    test:explain_no_trace('SELECT * FROM t1 LEFT JOIN t2 ON b=x WHERE c=1')    
+    test:explain_no_trace('SELECT * FROM t1 LEFT JOIN t2 ON b=x WHERE c=1')
     -- </where6-1.6>
     )
 
@@ -232,7 +232,7 @@ test:do_execsql_test(
 
 -- Ticket [ebdbadade5b]:
 -- If the ON close on a LEFT JOIN is of the form x=y where both x and y
--- are indexed columns on tables to left of the join, then do not use that 
+-- are indexed columns on tables to left of the join, then do not use that
 -- term with indices to either table.
 --
 test:do_test(
diff --git a/test/sql-tap/where7.test.lua b/test/sql-tap/where7.test.lua
index d3e7d91fe..ec577cb7d 100755
--- a/test/sql-tap/where7.test.lua
+++ b/test/sql-tap/where7.test.lua
@@ -450,7 +450,7 @@ test:do_test(
         ]]
     end, {
         -- <where7-2.1>
-        
+
         -- </where7-2.1>
     })
 
@@ -37491,7 +37491,7 @@ test:do_test(
 --   CREATE INDEX t302_c8_c3 on t302(c8, c3);
 --   CREATE INDEX t302_c5 on t302(c5);
 --   EXPLAIN QUERY PLAN
---   SELECT t302.c1 
+--   SELECT t302.c1
 --     FROM t302 JOIN t301 ON t302.c8 = +t301.c8
 --     WHERE t302.c2 = 19571
 --       AND t302.c3 > 1287603136
@@ -37499,9 +37499,9 @@ test:do_test(
 --            OR t301.c8 = 1407424651264000)
 --    ORDER BY t302.c5 LIMIT 200;
 -- } {
---   0 0 1 {SEARCH TABLE t301 USING COVERING INDEX t301_c4 (c4=?)} 
---   0 0 1 {SEARCH TABLE t301 USING INTEGER PRIMARY KEY (rowid=?)} 
---   0 1 0 {SEARCH TABLE t302 USING INDEX t302_c8_c3 (c8=? AND c3>?)} 
+--   0 0 1 {SEARCH TABLE t301 USING COVERING INDEX t301_c4 (c4=?)}
+--   0 0 1 {SEARCH TABLE t301 USING INTEGER PRIMARY KEY (rowid=?)}
+--   0 1 0 {SEARCH TABLE t302 USING INDEX t302_c8_c3 (c8=? AND c3>?)}
 --   0 0 0 {USE TEMP B-TREE FOR ORDER BY}
 -- }
 
diff --git a/test/sql-tap/whereD.test.lua b/test/sql-tap/whereD.test.lua
index e0e9a3853..a3851e526 100755
--- a/test/sql-tap/whereD.test.lua
+++ b/test/sql-tap/whereD.test.lua
@@ -15,7 +15,7 @@ test:plan(36)
 -------------------------------------------------------------------------
 -- This file implements regression tests for sql library.  The
 -- focus of this file is testing that an index may be used as a covering
--- index when there are OR expressions in the WHERE clause. 
+-- index when there are OR expressions in the WHERE clause.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -168,7 +168,7 @@ test:do_execsql_test(
         SELECT k FROM t WHERE (i=1 AND j=2) OR (i=2 AND j=1) OR (i=3 AND j=4);
     ]], {
         -- <1.15>
-        
+
         -- </1.15>
     })
 
@@ -199,7 +199,7 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(3,4);
     ]], {
         -- <2.0>
-        
+
         -- </2.0>
     })
 
diff --git a/test/sql-tap/whereF.test.lua b/test/sql-tap/whereF.test.lua
index 73c87abc9..3ac4f7a24 100755
--- a/test/sql-tap/whereF.test.lua
+++ b/test/sql-tap/whereF.test.lua
@@ -13,7 +13,7 @@ test:plan(13)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- Test cases for query planning decisions.
 --
 -- The tests in this file demonstrate the behaviour of the query planner
@@ -55,7 +55,7 @@ test:do_execsql_test(
         CREATE TABLE t2(d INT PRIMARY KEY, e INT, f INT);
     ]], {
         -- <1.0>
-        
+
         -- </1.0>
     })
 
@@ -83,7 +83,7 @@ test:do_execsql_test(
         CREATE UNIQUE INDEX i2 ON t1(b);
     ]], {
         -- <2.0>
-        
+
         -- </2.0>
     })
 
@@ -120,7 +120,7 @@ test:do_execsql_test(
         CREATE TABLE t2(d INT PRIMARY KEY, e INT, f INT);
     ]], {
         -- <3.0>
-        
+
         -- </3.0>
     })
 
diff --git a/test/sql-tap/whereG.test.lua b/test/sql-tap/whereG.test.lua
index 2a76d2438..49501a4a5 100755
--- a/test/sql-tap/whereG.test.lua
+++ b/test/sql-tap/whereG.test.lua
@@ -13,7 +13,7 @@ test:plan(23)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- Test cases for query planning decisions and the likely(), unlikely(), and
 -- likelihood() functions.
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
@@ -65,7 +65,7 @@ test:do_execsql_test(
         INSERT INTO track VALUES(10403, 6, 104, 'Qui tollis');
     ]], {
         -- <whereG-1.0>
-        
+
         -- </whereG-1.0>
     })
 
@@ -233,7 +233,7 @@ test:do_execsql_test(
         CREATE TABLE b(b1  INT PRIMARY KEY, b2 INT );
     ]], {
         -- <whereG-3.0>
-        
+
         -- </whereG-3.0>
     })
 
@@ -269,7 +269,7 @@ test:do_execsql_test(
     })
 
 ---------------------------------------------------------------------------
--- Test that likelihood() specifications on indexed terms are taken into 
+-- Test that likelihood() specifications on indexed terms are taken into
 -- account by various forms of loops.
 --
 --   5.1.*: open ended range scans
diff --git a/test/sql-tap/whereI.test.lua b/test/sql-tap/whereI.test.lua
index 43614b0eb..e2b28565f 100755
--- a/test/sql-tap/whereI.test.lua
+++ b/test/sql-tap/whereI.test.lua
@@ -13,7 +13,7 @@ test:plan(7)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- The focus of this file is testing the OR optimization on WITHOUT ROWID 
+-- The focus of this file is testing the OR optimization on WITHOUT ROWID
 -- tables.
 --
 -- Note: Tarantool has no rowid support, so all tables are WITHOUT ROWID.
@@ -33,7 +33,7 @@ test:do_execsql_test(1.0, [[
 -- do_eqp_test 1.1 {
 --   SELECT a FROM t1 WHERE b='b' OR c='x'
 -- } {
---   0 0 0 {SEARCH TABLE t1 USING INDEX i1 (b=?)} 
+--   0 0 0 {SEARCH TABLE t1 USING INDEX i1 (b=?)}
 --   0 0 0 {SEARCH TABLE t1 USING INDEX i2 (c=?)}
 -- }
 test:do_execsql_test(1.2, [[
@@ -68,7 +68,7 @@ test:do_execsql_test(2.0, [[
 -- do_eqp_test 2.1 {
 --   SELECT a FROM t2 WHERE b='b' OR c='x'
 -- } {
---   0 0 0 {SEARCH TABLE t2 USING INDEX i3 (b=?)} 
+--   0 0 0 {SEARCH TABLE t2 USING INDEX i3 (b=?)}
 --   0 0 0 {SEARCH TABLE t2 USING INDEX i4 (c=?)}
 -- }
 test:do_execsql_test(2.2, [[
diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua
index 32e187186..35f3dabb3 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -20,7 +20,7 @@ test:plan(64)
 -- ["source",[["testdir"],"\/tester.tcl"]]
 -- if X(0, "X!capable", [["!cte"]]) then
 --   test:finish_test()
---  return 
+--  return
 -- end
 
 test:do_execsql_test(1.0, [[
@@ -44,7 +44,7 @@ test:do_execsql_test(1.2, [[
   WITH x(a) AS ( SELECT * FROM t1) INSERT INTO t1 VALUES(1,1,2);
 ]], {
   -- <1.2>
-  
+
   -- </1.2>
 })
 
@@ -52,7 +52,7 @@ test:do_execsql_test(1.3, [[
   WITH x(a) AS ( SELECT * FROM t1) DELETE FROM t1;
 ]], {
   -- <1.3>
-  
+
   -- </1.3>
 })
 
@@ -60,7 +60,7 @@ test:do_execsql_test(1.4, [[
   WITH x(a) AS ( SELECT * FROM t1) UPDATE t1 SET x = y;
 ]], {
   -- <1.4>
-  
+
   -- </1.4>
 })
 
@@ -470,7 +470,7 @@ test:do_execsql_test(7.2, [[
     SELECT i, '' FROM tree WHERE p IS NULL
     UNION ALL
     SELECT i, path || '/' || CAST(i as TEXT) FROM tree, t WHERE p = id
-  ) 
+  )
   SELECT path FROM t;
 ]], {
   -- <7.2>
@@ -483,7 +483,7 @@ test:do_execsql_test(7.3, [[
     VALUES(2)
     UNION ALL
     SELECT i FROM tree, t WHERE p = id
-  ) 
+  )
   SELECT id FROM t;
 ]], {
   -- <7.3>
@@ -496,7 +496,7 @@ test:do_catchsql_test(7.4, [[
     VALUES(2)
     UNION ALL
     SELECT i FROM tree WHERE p IN (SELECT id FROM t)
-  ) 
+  )
   SELECT id FROM t;
 ]], {
   -- <7.4>
@@ -509,7 +509,7 @@ test:do_catchsql_test(7.5, [[
     VALUES(2)
     UNION ALL
     SELECT i FROM tree, t WHERE p = id AND p IN (SELECT id FROM t)
-  ) 
+  )
   SELECT id FROM t;
 ]], {
   -- <7.5>
@@ -522,7 +522,7 @@ test:do_catchsql_test(7.6, [[
     SELECT i FROM tree WHERE 2 IN (SELECT id FROM t)
     UNION ALL
     SELECT i FROM tree, t WHERE p = id
-  ) 
+  )
   SELECT id FROM t;
 ]], {
   -- <7.6>
@@ -539,7 +539,7 @@ test:do_execsql_test("8.1-mandelbrot", [[
     m(iter, cx, cy, x, y) AS (
       SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis
       UNION ALL
-      SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m 
+      SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m
        WHERE (x*x + y*y) < 4.0 AND iter<28
     ),
     m2(iter, cx, cy) AS (
@@ -702,7 +702,7 @@ limit_test(9.7, 40, -1)
 --   )
 --   SELECT p FROM flat ORDER BY p;
 -- } {
---   /a /a/a /a/a/a 
+--   /a /a/a /a/a/a
 --      /a/b /a/b/c /a/b/c/d
 --           /a/b/d
 -- }
@@ -712,10 +712,10 @@ limit_test(9.7, 40, -1)
 -- proc scan_tree {bDepthFirst bReverse} {
 --   set order "ORDER BY "
 --   if {$bDepthFirst==0} { append order "2 ASC," }
---   if {$bReverse==0} { 
---     append order " 3 ASC" 
+--   if {$bReverse==0} {
+--     append order " 3 ASC"
 --   } else {
---     append order " 3 DESC" 
+--     append order " 3 DESC"
 --   }
 --   db eval "
 --     WITH flat(fid, depth, p) AS (
@@ -750,7 +750,7 @@ limit_test(9.7, 40, -1)
 --   scan_tree 1 0
 -- } [list {*}{
 --   /a /a/b /a/b/c
---      /a/d /a/d/e 
+--      /a/d /a/d/e
 --           /a/d/f
 --   /g /g/h
 -- }]
@@ -759,9 +759,9 @@ limit_test(9.7, 40, -1)
 -- do_test 10.5 {
 --   scan_tree 0 1
 -- } [list {*}{
---   /g /a 
---   /g/h /a/d /a/b 
---   /a/d/f /a/d/e /a/b/c 
+--   /g /a
+--   /g/h /a/d /a/b
+--   /a/d/f /a/d/e /a/b/c
 -- }]
 -- # Depth first, siblings in ascending order.
 -- #
@@ -769,8 +769,8 @@ limit_test(9.7, 40, -1)
 --   scan_tree 1 1
 -- } [list {*}{
 --   /g /g/h
---   /a /a/d /a/d/f 
---           /a/d/e 
+--   /a /a/d /a/d/f
+--           /a/d/e
 --      /a/b /a/b/c
 -- }]
 -- Test name resolution in ORDER BY clauses.
@@ -778,7 +778,7 @@ limit_test(9.7, 40, -1)
 test:do_catchsql_test("10.7.1", [[
   WITH t(a) AS (
     SELECT 1 AS b UNION ALL SELECT a+1 AS c FROM t WHERE a<5 ORDER BY a
-  ) 
+  )
   SELECT * FROM t
 ]], {
   -- <10.7.1>
@@ -789,7 +789,7 @@ test:do_catchsql_test("10.7.1", [[
 test:do_execsql_test("10.7.2", [[
   WITH t(a) AS (
     SELECT 1 AS b UNION ALL SELECT a+1 AS c FROM t WHERE a<5 ORDER BY b
-  ) 
+  )
   SELECT * FROM t
 ]], {
   -- <10.7.2>
@@ -824,7 +824,7 @@ test:do_execsql_test("10.7.2", [[
 -- }
 -- do_execsql_test 10.8.2 {
 --   WITH flat(fid, depth, p) AS (
---       SELECT id, 1, ('/' || payload) COLLATE nocase 
+--       SELECT id, 1, ('/' || payload) COLLATE nocase
 --       FROM tree WHERE parentid IS NULL
 --     UNION ALL
 --       SELECT id, depth+1, (p||'/'||payload)
@@ -841,7 +841,7 @@ test:do_execsql_test("10.7.2", [[
 --       SELECT id, 1, ('/' || payload)
 --       FROM tree WHERE parentid IS NULL
 --     UNION ALL
---       SELECT id, depth+1, (p||'/'||payload) COLLATE nocase 
+--       SELECT id, depth+1, (p||'/'||payload) COLLATE nocase
 --       FROM flat, tree WHERE parentid=fid
 --     ORDER BY 2, 3
 --   )
@@ -909,7 +909,7 @@ test:do_execsql_test("10.8.4.3", [[
 --   INSERT INTO org VALUES('Xia','Xaviar');
 --   INSERT INTO org VALUES('Xerxes','Xaviar');
 --   INSERT INTO org VALUES('Xena','Xia');
---   -- Find all members of Alice's group, breath-first order  
+--   -- Find all members of Alice's group, breath-first order
 --   WITH RECURSIVE
 --     under_alice(name,level) AS (
 --        VALUES('Alice','0')
@@ -997,7 +997,7 @@ test:do_execsql_test("10.8.4.3", [[
 -- .........Olivia}}
 ----------------------------------------------------------------------------
 -- Ticket [31a19d11b97088296ac104aaff113a9790394927] (2014-02-09)
--- Name resolution issue with compound SELECTs and Common Table Expressions 
+-- Name resolution issue with compound SELECTs and Common Table Expressions
 --
 test:do_execsql_test(12.1, [[
   WITH RECURSIVE
@@ -1046,7 +1046,7 @@ test:do_execsql_test(14.1, [[
   WITH x AS (SELECT * FROM t) SELECT 0 EXCEPT SELECT 0 ORDER BY 1;
 ]], {
   -- <14.1>
-  
+
   -- </14.1>
 })
 
diff --git a/test/sql-tap/with2.test.lua b/test/sql-tap/with2.test.lua
index c16efac4d..5951765e8 100755
--- a/test/sql-tap/with2.test.lua
+++ b/test/sql-tap/with2.test.lua
@@ -85,7 +85,7 @@ test:do_execsql_test(
         WITH x1 AS (SELECT a FROM t1),
              x2 AS (SELECT i FROM t2),
              x3 AS (SELECT * FROM x1, x2 WHERE x1.a IN x2 AND x2.i IN x1)
-        SELECT * FROM x3 
+        SELECT * FROM x3
     ]], {
         -- <1.5>
         2, 2
@@ -137,10 +137,10 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.11,
     [[
-        WITH 
-        i(x) AS ( 
-          WITH 
-          j(x) AS ( SELECT * FROM i ), 
+        WITH
+        i(x) AS (
+          WITH
+          j(x) AS ( SELECT * FROM i ),
           i(x) AS ( SELECT * FROM t1 )
           SELECT * FROM j
         )
@@ -191,10 +191,10 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.14,
     [[
-        WITH 
-        t4(x) AS ( 
+        WITH
+        t4(x) AS (
           VALUES(4)
-          UNION ALL 
+          UNION ALL
           SELECT x+1 FROM t4 WHERE x<10
         )
         SELECT * FROM t4;
@@ -205,10 +205,10 @@ test:do_execsql_test(
     })
 
 test:do_catchsql_test(1.16, [[
-    WITH 
-    t4(x) AS ( 
+    WITH
+    t4(x) AS (
       VALUES(4)
-      UNION ALL 
+      UNION ALL
       SELECT x+1 FROM t4, t4, t4 WHERE x<10
     )
     SELECT * FROM t4;
@@ -262,7 +262,7 @@ test:do_catchsql_test(3.1, [[
 })
 
 test:do_catchsql_test(3.2, [[
-    WITH 
+    WITH
     i(x) AS ( SELECT * FROM j ),
     j(x) AS ( SELECT * FROM k ),
     k(x) AS ( SELECT * FROM i )
@@ -274,7 +274,7 @@ test:do_catchsql_test(3.2, [[
 })
 
 test:do_catchsql_test(3.3, [[
-    WITH 
+    WITH
     i(x) AS ( SELECT * FROM (SELECT * FROM j) ),
     j(x) AS ( SELECT * FROM (SELECT * FROM i) )
     SELECT * FROM i;
@@ -285,7 +285,7 @@ test:do_catchsql_test(3.3, [[
 })
 
 test:do_catchsql_test(3.4, [[
-    WITH 
+    WITH
     i(x) AS ( SELECT * FROM (SELECT * FROM j) ),
     j(x) AS ( SELECT * FROM (SELECT * FROM i) )
     SELECT * FROM j;
@@ -296,8 +296,8 @@ test:do_catchsql_test(3.4, [[
 })
 
 test:do_catchsql_test(3.5, [[
-    WITH 
-    i(x) AS ( 
+    WITH
+    i(x) AS (
       WITH j(x) AS ( SELECT * FROM i )
       SELECT * FROM j
     )
@@ -613,10 +613,10 @@ test:do_execsql_test(
         CREATE TABLE t6(y INTEGER PRIMARY KEY);
 
         WITH s(x) AS ( VALUES(7) UNION ALL SELECT x+7 FROM s WHERE x<49 )
-        INSERT INTO t5 
+        INSERT INTO t5
         SELECT * FROM s;
 
-        INSERT INTO t6 
+        INSERT INTO t6
         WITH s(x) AS ( VALUES(2) UNION ALL SELECT x+2 FROM s WHERE x<49 )
         SELECT * FROM s;
     ]])
@@ -667,7 +667,7 @@ test:do_execsql_test(
     })
 
 ---------------------------------------------------------------------------
--- At one point the following was causing an assertion failure and a 
+-- At one point the following was causing an assertion failure and a
 -- memory leak.
 --
 test:do_execsql_test(
@@ -683,7 +683,7 @@ test:do_execsql_test(
     [[
         WITH q(a) AS (
           SELECT 1
-          UNION 
+          UNION
           SELECT a+1 FROM q, v WHERE a<5
         )
         SELECT * FROM q;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 13/14] test: fix luacheck warnings W621 in test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (11 preceding siblings ...)
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 12/14] test: fix luacheck warnings W612, W613, W614 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:50 ` Sergey Bronnikov via Tarantool-patches
  2021-01-24 17:37   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 14/14] luacheck: add issues for suppressed warnings Sergey Bronnikov via Tarantool-patches
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:50 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

W621 (Inconsistent indentation (SPACE followed by TAB))

Part of #5464
---
 .luacheckrc                    |  2 --
 test/sql-tap/analyze7.test.lua | 14 +++++++-------
 test/sql-tap/analyzeD.test.lua |  8 ++++----
 test/sql-tap/analyzeF.test.lua |  2 +-
 test/sql-tap/index1.test.lua   |  2 +-
 5 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 69be93a67..a798ca6f8 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -53,8 +53,6 @@ files["test/sql-tap/**/*.lua"] = {
     ignore = {
         -- A line consists of nothing but whitespace.
         "611",
-        -- Inconsistent indentation (SPACE followed by TAB).
-        "621",
         -- Line is too long.
         "631"
     }
diff --git a/test/sql-tap/analyze7.test.lua b/test/sql-tap/analyze7.test.lua
index 203a0c3f9..8aa29e951 100755
--- a/test/sql-tap/analyze7.test.lua
+++ b/test/sql-tap/analyze7.test.lua
@@ -29,11 +29,11 @@ test:do_test(
 		    DROP TABLE IF EXISTS nums;
 			CREATE TABLE nums(n  INT PRIMARY KEY);
 			INSERT into nums WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<256) SELECT x FROM cnt;
- 			INSERT INTO t1 SELECT n, n, n, n/100, n FROM nums;
- 			EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=123;
+                        INSERT INTO t1 SELECT n, n, n, n/100, n FROM nums;
+                        EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=123;
 		]])
 		end, {
-        	-- <analyze7-1.0>
+                -- <analyze7-1.0>
             0, 0, 0, "SEARCH TABLE T1 USING COVERING INDEX T1A (A=?)"
             -- </analyze7-1.0>
         })
@@ -43,7 +43,7 @@ test:do_execsql_test(
 	[[
 		EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE b=123;
 	]], {
-    	-- <analyze7-1.1>
+        -- <analyze7-1.1>
         0, 0, 0, "SEARCH TABLE T1 USING COVERING INDEX T1B (B=?)"
         -- </analyze7-1.1>
     })
@@ -68,7 +68,7 @@ test:do_test(
 		test:execsql("ANALYZE;")
 		return test:execsql("EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=123;")
 	end, {
-       	-- <analyze7-2.0>
+        -- <analyze7-2.0>
         0, 0, 0, "SEARCH TABLE T1 USING COVERING INDEX T1A (A=?)"
         -- </analyze7-2.0>
     })
@@ -147,9 +147,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "analyze7-3.2.2",
     [[
-    	EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE c=2;
+        EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE c=2;
     ]], {
-    	-- <analyze7-3.2.2>
+        -- <analyze7-3.2.2>
         0, 0, 0, "SEARCH TABLE T1 USING COVERING INDEX T1CD (C=?)"
         -- </analyze7-3.2.2>
     })
diff --git a/test/sql-tap/analyzeD.test.lua b/test/sql-tap/analyzeD.test.lua
index e0426b974..c6b9fa206 100755
--- a/test/sql-tap/analyzeD.test.lua
+++ b/test/sql-tap/analyzeD.test.lua
@@ -54,8 +54,8 @@ test:do_test(
 			ANALYZE;
 		]])
 	end, {
-        	-- <1.1>
-        	-- </1.1>
+                -- <1.1>
+                -- </1.1>
     })
 
 -- With full ANALYZE data, sql sees that c=150 (5 rows) is better than
@@ -122,7 +122,7 @@ test:do_test(
 	end, {
         -- <1.7>
         -- </1.7>
-   	})
+        })
 
 -- Same test as 1.4, except this time the 7 rows that match the a=? condition
 -- do not feature larger values than all rows in the stat4 table. So sql
@@ -135,7 +135,7 @@ test:do_execsql_test(
         -- <1.8>
         0, 0, 0, "SEARCH TABLE T1 USING COVERING INDEX T1_C (C=?)"
         -- </1.8>
-   	})
+        })
 
 test:do_catchsql_test(
 	"analyzeD-1.9",
diff --git a/test/sql-tap/analyzeF.test.lua b/test/sql-tap/analyzeF.test.lua
index 0b621a3ae..cbb088415 100755
--- a/test/sql-tap/analyzeF.test.lua
+++ b/test/sql-tap/analyzeF.test.lua
@@ -25,7 +25,7 @@ box.internal.sql_create_function("isqrt", "NUMBER", isqrt)
 test:do_execsql_test(
     1.0,
     [[
-    	DROP TABLE IF EXISTS t1;
+        DROP TABLE IF EXISTS t1;
         CREATE TABLE t1(id  INT PRIMARY KEY, x INTEGER, y INTEGER);
         WITH data(i) AS (SELECT 1 UNION ALL SELECT i+1 FROM data) INSERT INTO t1 SELECT i, isqrt(i), isqrt(i) FROM data LIMIT 500;
         CREATE INDEX t1y ON t1(y);
diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
index 1ac02d60c..e647c22fe 100755
--- a/test/sql-tap/index1.test.lua
+++ b/test/sql-tap/index1.test.lua
@@ -406,7 +406,7 @@ test:do_test(
 test:do_catchsql_test(
     "index-8.1",
     [[
-    	CREATE TABLE test1(a INT PRIMARY KEY);
+        CREATE TABLE test1(a INT PRIMARY KEY);
         DROP INDEX index1 ON test1
     ]], {
         -- <index-8.1>
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [Tarantool-patches] [PATCH v8 14/14] luacheck: add issues for suppressed warnings
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (12 preceding siblings ...)
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 13/14] test: fix luacheck warnings W621 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-21 12:50 ` Sergey Bronnikov via Tarantool-patches
  2021-01-24 17:37   ` Vladislav Shpilevoy via Tarantool-patches
  2021-03-01 21:37 ` [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Vladislav Shpilevoy via Tarantool-patches
  2021-03-02  9:47 ` Kirill Yukhin via Tarantool-patches
  15 siblings, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:50 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

Closes #5464
---
 .luacheckrc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.luacheckrc b/.luacheckrc
index a798ca6f8..597988367 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -52,8 +52,10 @@ exclude_files = {
 files["test/sql-tap/**/*.lua"] = {
     ignore = {
         -- A line consists of nothing but whitespace.
+        -- https://github.com/tarantool/tarantool/issues/5739
         "611",
         -- Line is too long.
+        -- https://github.com/tarantool/tarantool/issues/5181
         "631"
     }
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap Sergey Bronnikov via Tarantool-patches
@ 2021-01-24 17:33   ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-06 17:52     ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-16 12:02     ` Sergey Bronnikov via Tarantool-patches
  2021-02-26 23:42   ` Vladislav Shpilevoy via Tarantool-patches
  1 sibling, 2 replies; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-01-24 17:33 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Hi! Thanks for the patch!

See 3 comments below.

On 21.01.2021 13:49, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> W113 (Accessing an undefined global variable)
> 
> Part of #5464
> ---
>  .luacheckrc                    |  37 +++++++++-
>  test/sql-tap/badutf1.test.lua  |  10 ++-
>  test/sql-tap/index1.test.lua   |   2 +-
>  test/sql-tap/lua/sqltester.lua |   2 +-
>  test/sql-tap/lua_sql.test.lua  |   6 +-
>  test/sql-tap/minmax2.test.lua  |   2 +
>  test/sql-tap/select1.test.lua  |   4 ++
>  test/sql-tap/subquery.test.lua |   7 +-
>  test/sql-tap/table.test.lua    |   6 +-
>  test/sql-tap/tkt1443.test.lua  |   2 +-
>  test/sql-tap/trigger9.test.lua |   1 +
>  test/sql-tap/triggerC.test.lua |   1 -
>  test/sql-tap/view.test.lua     | 126 +++++++++++++++------------------
>  13 files changed, 122 insertions(+), 84 deletions(-)
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 81aa61a2b..eb709d6a3 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -124,3 +122,38 @@ files["test/box-tap/extended_error.test.lua"] = {
>          "forbidden_function",
>      },
>  }
> +files["test/sql-tap/analyze5.test.lua"] = {
> +    ignore = {
> +        "113",
> +    },
> +}
> +files["test/sql-tap/cast.test.lua"] = {
> +    ignore = {
> +        "113",
> +    },
> +}
> +files["test/sql-tap/func.test.lua"] = {
> +    ignore = {
> +        "113",
> +    },
> +}
> +files["test/sql-tap/e_expr.test.lua"] = {
> +    ignore = {
> +        "113",
> +    },
> +}
> +files["test/sql-tap/e_select1.test.lua"] = {
> +    ignore = {
> +        "113",
> +    },
> +}
> +files["test/sql-tap/misc1.test.lua"] = {
> +    ignore = {
> +        "113",
> +    },
> +}
> +files["test/sql-tap/sort.test.lua"] = {
> +    ignore = {
> +        "113",
> +    },
> +}

1. The commit title says "fix", but it does not look like a fix.
I suggest you to try harder to remove the warnings, not hide them.
For example, analyze5 can be fixed like this:

====================
diff --git a/.luacheckrc b/.luacheckrc
index eb709d6a3..977eb2945 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -122,11 +122,6 @@ files["test/box-tap/extended_error.test.lua"] = {
         "forbidden_function",
     },
 }
-files["test/sql-tap/analyze5.test.lua"] = {
-    ignore = {
-        "113",
-    },
-}
 files["test/sql-tap/cast.test.lua"] = {
     ignore = {
         "113",
diff --git a/test/sql-tap/analyze5.test.lua b/test/sql-tap/analyze5.test.lua
index 1d6665ad0..a9eb4dd2f 100755
--- a/test/sql-tap/analyze5.test.lua
+++ b/test/sql-tap/analyze5.test.lua
@@ -26,6 +26,8 @@ local function eqp(sql)
     return test:execsql("EXPLAIN QUERY PLAN"..sql)
 end
 
+local X = nil
+
 local function alpha(blob)
     local ret = ""
     for _, c in ipairs(X(37, "X!cmd", [=[["split",["blob"],""]]=])) do
@@ -155,6 +157,9 @@ test:do_test(
 
 -- Verify that range queries generate the correct row count estimates
 --
+local t1x = nil
+local t1y = nil
+local t1z = nil
 for i, v in pairs({
 {'z>=0 AND z<=0',      t1z,  400},
 {'z>=1 AND z<=1',      t1z,  300},
====================

It does not make much sense, and the whole test does not make it, because
it is disabled. But it is better than just move the ignores from one
place to another. At least now they are local to the disabled places,
not to the whole file.

Cast.test.lua:

====================
diff --git a/.luacheckrc b/.luacheckrc
index eb709d6a3..15944e378 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -127,11 +127,6 @@ files["test/sql-tap/analyze5.test.lua"] = {
         "113",
     },
 }
-files["test/sql-tap/cast.test.lua"] = {
-    ignore = {
-        "113",
-    },
-}
 files["test/sql-tap/func.test.lua"] = {
     ignore = {
         "113",
diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
index 4d7c92cfc..bcee65d9b 100755
--- a/test/sql-tap/cast.test.lua
+++ b/test/sql-tap/cast.test.lua
@@ -786,13 +786,19 @@ test:do_execsql_test(
 -- Test to see if it is possible to trick sql into reading past
 -- the end of a blob when converting it to a number.
 if 0 > 0 then
+-- Legacy from the original code. Must be replaced with analogue
+-- functions from box.
+local sql_prepare = nil
+local sql_bind_blob = nil
+local sql_step = nil
+local sql_column_int = nil
+local STMT
 test:do_test(
     "cast-3.32.1",
     function()
-        local blob, DB, STMT
+        local blob
         blob = 1234567890
-        DB = sql_connection_pointer("db")
-        STMT = sql_prepare(DB, "SELECT CAST(? AS NUMBER)", -1, "TAIL")
+        STMT = sql_prepare("SELECT CAST(? AS NUMBER)", -1, "TAIL")
         sql_bind_blob("-static", STMT, 1, blob, 5)
         return sql_step(STMT)
     end, {
====================

Func.test.lua:

====================
diff --git a/.luacheckrc b/.luacheckrc
index eb709d6a3..7608240c5 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -132,11 +132,6 @@ files["test/sql-tap/cast.test.lua"] = {
         "113",
     },
 }
-files["test/sql-tap/func.test.lua"] = {
-    ignore = {
-        "113",
-    },
-}
 files["test/sql-tap/e_expr.test.lua"] = {
     ignore = {
         "113",
diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
index d14eef421..a83b15fbc 100755
--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -1048,7 +1048,8 @@ test:do_execsql_test(
 --
 -- MUST_WORK_TEST testfunc not implemented
 if 0 > 0 then
-local DB = sql_connection_pointer("db")
+local DB = nil
+local X = nil
 X(525, "X!cmd", [=[["sql_register_test_function",["::DB"],"testfunc"]]=])
 test:do_catchsql_test(
     "func-10.1",
@@ -1142,6 +1143,18 @@ end
 --
 -- MUST_WORK_TEST test_destructor_count not implemented
 if 0 > 0 then
+local X = nil
+-- Legacy from the original code. Must be replaced with analogue
+-- functions from box.
+local sql_prepare = nil
+local sql_bind_text = nil
+local sql_bind_blob = nil
+local sql_column_text = nil
+local sql_step = nil
+local sql_finalize = nil
+local db = nil
+local STMT
+
 if X(595, "X!cmd", "[\"expr\",\"[db eval {PRAGMA encoding}]==\\\"UTF-8\\\"\"]")
  then
     test:do_execsql_test(
@@ -1300,10 +1313,9 @@ test:do_execsql_test(
 test:do_test(
     "func-13.7",
     function()
-        local DB, sql, STMT, res
-        DB = sql_connection_pointer("db")
+        local sql, STMT, res
         sql = "SELECT test_auxdata( ? , a ) FROM t4;"
-        STMT = sql_prepare(DB, sql, -1, "TAIL")
+        STMT = sql_prepare(sql, -1, "TAIL")
         sql_bind_text(STMT, 1, "hello\0", -1)
         res = {  }
         while X(690, "X!cmd", [=[["expr"," \"sql_ROW\"==[sql_step $STMT] "]]=])
@@ -1455,7 +1467,7 @@ test:do_test(
         test:execsql([[
             CREATE TABLE tbl2(id integer primary key, a INT, b INT);
         ]])
-        local STMT = sql_prepare(DB, "INSERT INTO tbl2 VALUES(1, ?, ?)", -1, "TAIL")
+        local STMT = sql_prepare("INSERT INTO tbl2 VALUES(1, ?, ?)", -1, "TAIL")
         sql_bind_blob(STMT, 1, "abc", 3)
         sql_step(STMT)
         sql_finalize(STMT)
@@ -2439,6 +2451,7 @@ test:do_execsql_test(
 --
 -- MUST_WORK_TEST
 if 0>0 then
+local X = nil
 test:do_execsql_test(
     "func-25.1",
     [[
@@ -2470,7 +2483,7 @@ test:do_test(
     "func-26.2",
     function()
         local a = ""
-        for _ in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG","incr i"]]=]) do
+        for i in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG","incr i"]]=]) do
             table.insert(a,i)
         end
         return test:execsql(string.format([[
@@ -2486,7 +2499,7 @@ test:do_test(
     "func-26.3",
     function()
         local a = ""
-        for _ in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG+1","incr i"]]=]) do
+        for i in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG+1","incr i"]]=]) do
             table.insert(a,i)
         end
         return test:catchsql(string.format([[
@@ -2502,7 +2515,7 @@ test:do_test(
     "func-26.4",
     function()
         local a = ""
-        for _ in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG-1","incr i"]]=]) do
+        for i in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG-1","incr i"]]=]) do
             table.insert(a,i)
         end
         return test:catchsql(string.format([[
====================

I am sure the other files also can be properly fixed, with stubs
and comments for legacy old functions, and with normal fixes for
the things like in the last lines of the diff above, where it was
a real bug - loop variable was not defined.

> diff --git a/test/sql-tap/badutf1.test.lua b/test/sql-tap/badutf1.test.lua
> index 654629bf7..b7fa8ce0b 100755
> --- a/test/sql-tap/badutf1.test.lua
> +++ b/test/sql-tap/badutf1.test.lua
> @@ -93,8 +93,12 @@ test:do_test(
>      })
>  
>  -- commented as it uses utf16
> -if 0>0 then
> -sql("db2", "")
> +-- testcases are broken
> +-- https://github.com/tarantool/tarantool/issues/5743
> +local is_gh_5743_closed = false
> +if is_gh_5743_closed then
> +sql("db2", "") -- luacheck: ignore sql
> +-- luacheck: push ignore sql_exec

2. Or you can use 'local sql_exec = nil', and won't need to
write 'pop'.

The same to the other places, where you try to ignore the same
unknown variable again and again. However I don't insist on
hacks vs luacheck comments.

>  test:do_test(
>      "badutf-1.10",
>      function()
> @@ -206,7 +210,7 @@ test:do_test(
>          -- </badutf-1.20>
>      })
>  end
> -
> +-- luacheck: pop
>  > diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua
> index 2f1af29b0..67f461132 100755
> --- a/test/sql-tap/view.test.lua
> +++ b/test/sql-tap/view.test.lua
> @@ -1,6 +1,6 @@
>  #!/usr/bin/env tarantool
>  local test = require("sqltester")
> -test:plan(78)
> +test:plan(83)
>  
>  --!./tcltestrunner.lua
>  -- 2002 February 26
> @@ -501,21 +501,18 @@ test:do_execsql_test(
>      })
>  
>  -- MUST_WORK_TEST

3. Why did you keep MUST_WORK_TEST, if it passes now?
The same in other places below.

> -if (0 > 0)
> - then
> -    test:do_test(
> -        "view-7.2",
> -        function()
> -            return test:execsql [[
> -                SELECT * FROM test;
> -            ]]
> -        end, {
> -            -- <view-7.2>
> -            1, 2, 3
> -            -- </view-7.2>
> -        })
> +test:do_test(
> +    "view-7.2",
> +    function()
> +        return test:execsql [[
> +            SELECT * FROM test;
> +        ]]
> +    end, {
> +        -- <view-7.2>
> +        1, 2, 3
> +        -- </view-7.2>
> +    })
>  
> -end
>  test:do_execsql_test(
>      "view-7.3",
>      [[
> @@ -531,21 +528,18 @@ test:do_execsql_test(
>      })
>  
>  -- MUST_WORK_TEST
> -if (0 > 0)
> - then
> -    test:do_test(
> -        "view-7.4",
> -        function()
> -            return test:execsql [[
> -                SELECT * FROM test;
> -            ]]
> -        end, {
> -            -- <view-7.4>
> -            1, 2, 3
> -            -- </view-7.4>
> -        })
> +test:do_test(
> +    "view-7.4",
> +    function()
> +        return test:execsql [[
> +            SELECT * FROM test;
> +        ]]
> +    end, {
> +        -- <view-7.4>
> +        1, 2, 3
> +        -- </view-7.4>
> +    })
>  
> -end
>  test:do_execsql_test(
>      "view-7.5",
>      [[
> @@ -561,21 +555,18 @@ test:do_execsql_test(
>      })
>  
>  -- MUST_WORK_TEST
> -if (0 > 0)
> - then
> -    test:do_test(
> -        "view-7.6",
> -        function()
> -            return test:execsql [[
> -                SELECT * FROM test;
> -            ]]
> -        end, {
> -            -- <view-7.6>
> -            1, 2, 3
> -            -- </view-7.6>
> -        })
> +test:do_test(
> +    "view-7.6",
> +    function()
> +        return test:execsql [[
> +            SELECT * FROM test;
> +        ]]
> +    end, {
> +        -- <view-7.6>
> +        1, 2, 3
> +        -- </view-7.6>
> +    })
>  
> -end
>  test:do_execsql_test(
>      "view-8.1",
>      [[
> @@ -588,33 +579,29 @@ test:do_execsql_test(
>      })
>  
>  -- MUST_WORK_TEST
> -if (0 > 0)
> - then
> -    test:do_test(
> -        "view-8.2",
> -        function()
> -            return test:execsql [[
> -                SELECT * FROM v6 ORDER BY xyz;
> -            ]]
> -        end, {
> -            -- <view-8.2>
> -            7, 2, 13, 5, 19, 8, 27, 12
> -            -- </view-8.2>
> -        })
> -
> -    -- MUST_WORK_TEST problem with column names
> -    test:do_execsql_test(
> -        "view-8.3",
> -        [[
> -            CREATE VIEW v7(a) AS SELECT pqr+xyz FROM v6;
> -            SELECT * FROM v7 ORDER BY a;
> -        ]], {
> -            -- <view-8.3>
> -            9, 18, 27, 39
> -            -- </view-8.3>
> -        })
> +test:do_test(
> +    "view-8.2",
> +    function()
> +        return test:execsql [[
> +            SELECT * FROM v6 ORDER BY xyz;
> +        ]]
> +    end, {
> +        -- <view-8.2>
> +        7, 2, 13, 5, 19, 8, 27, 12
> +        -- </view-8.2>
> +    })
>  
> -end
> +-- MUST_WORK_TEST problem with column names
> +test:do_execsql_test(
> +    "view-8.3",
> +    [[
> +        CREATE VIEW v7(a) AS SELECT pqr+xyz FROM v6;
> +        SELECT * FROM v7 ORDER BY a;
> +    ]], {
> +        -- <view-8.3>
> +        9, 18, 27, 39
> +        -- </view-8.3>
> +    })
>  
>  test:do_execsql_test(
>      "view-8.4",

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-24 17:34   ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-16 14:09     ` Sergey Bronnikov via Tarantool-patches
  2021-02-23 21:26   ` Vladislav Shpilevoy via Tarantool-patches
  1 sibling, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-01-24 17:34 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Thanks for the patch!

See 2 comments below.

On 21.01.2021 13:49, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> W211 (Unused local variable)
> 
> Part of #5464
> 
> test: fix luacheck warnings W111 in test/sql-tap
> ---
> diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
> index 81b08e223..f29b26175 100755
> --- a/test/sql-tap/e_expr.test.lua
> +++ b/test/sql-tap/e_expr.test.lua
> @@ -1080,7 +1080,6 @@ if (0>0) then
>      local function parameter_test(tn, sql, params, result)
>          local stmt = sql_prepare_v2("db", sql, -1)
>          for _ in X(0, "X!foreach", [=[["number name",["params"]]]=]) do
> -            local nm = sql_bind_parameter_name(stmt, number)

1. You should not delete the function call. It seems it must have
had an effect on the statement object. Without this call in future it
will be harder to understand what is missing if you delete it.

>              X(480, "X!cmd", [=[["do_test",[["tn"],".name.",["number"]],[["list","set","",["nm"]]],["name"]]]=])
>              sql_bind_int(stmt, number, ((-1) * number))
>          end
> diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
> index 7d928bea0..b1c4f026b 100755
> --- a/test/sql-tap/misc1.test.lua
> +++ b/test/sql-tap/misc1.test.lua
> @@ -726,19 +726,8 @@ test:do_execsql_test(
>  -- MUST_WORK_TEST collate
>  if 0>0 then
>      db("collate", "numeric", "numeric_collate")
> -    local function numeric_collate(lhs, rhs)
> -        if (lhs == rhs)
> -        then
> -            return 0
> -        end
> -        return X(0, "X!expr", [=[["?:",[">",["lhs"],["rhs"]],3,["-",1]]]=])
> -    end

2. The more I look at these db + X pairs, the more it seems like an
artifact after TCL -> Lua conversion. I think originally it was
supposed that the function after 'db()' should be called, and 'X'
should execute something. Worth investigating how these tests looked
originally. Otherwise we may delete too much and not able to resurrect
the tests in future.

If these code blocks are important for understanding the test (which I
don't understand now, but anyway), maybe it would better to comment
them out instead of deleing.

Or delete the entire test cases if we are not going to try to resurrect
them, which is also fine.

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 06/14] test: fix laucheck warnings W213 in test/sql-tap
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 06/14] test: fix laucheck warnings W213 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-24 17:35   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-29 16:32     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-01-24 17:35 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Thanks for the patch!

On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@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?

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 07/14] test: fix luacheck warnings W231 in test/sql-tap
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 07/14] test: fix luacheck warnings W231 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-24 17:35   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-29 22:39     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-01-24 17:35 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Thanks for the patch!

On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> W231 (Local variable is set but never accessed)
> 
> Part of #5464
> ---
> diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
> index 5f8b206d3..b488bdc60 100755
> --- a/test/sql-tap/e_expr.test.lua
> +++ b/test/sql-tap/e_expr.test.lua
> @@ -2554,9 +2550,6 @@ test:do_test(
>  -- evaluation of the THEN expression that corresponds to the first WHEN
>  -- expression that evaluates to true.
>  --
> -a = 0
> -b = 1
> -c = 0

These look like an artifact of a wrong conversion from TCL to Lua.
The variables are used in the SQL statements. I think the converter
thought it could just declare them as Lua variables to make visible
in SQL. Better keep them and add MUST_WORK_TEST if it is not here yet.

So in future we would see the expected variable values, and either
decide fix the tests or delete them entirely. The latter can easily
happen due to how much the type system was reworked.

>  test:do_execsql_test(
>      "e_expr-21.2.1",
>      [[

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 12/14] test: fix luacheck warnings W612, W613, W614 in test/sql-tap
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 12/14] test: fix luacheck warnings W612, W613, W614 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-24 17:36   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-29 16:23     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-01-24 17:36 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Thanks for the patch!

See 3 comments below.

On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> W612 (A line contains trailing whitespace)
> W613 (Trailing whitespace in a string)
> W614 (Trailing whitespace in a comment)
> 
> Note: changes were made automatically in vim with regexp "%s/\s\+$//e".
> 
> Part of #5464
> ---
> diff --git a/test/sql-tap/analyzeD.test.lua b/test/sql-tap/analyzeD.test.lua
> index 12722a3d4..e0426b974 100755
> --- a/test/sql-tap/analyzeD.test.lua
> +++ b/test/sql-tap/analyzeD.test.lua
> @@ -54,7 +54,7 @@ test:do_test(
>  			ANALYZE;
>  		]])
>  	end, {
> -        	-- <1.1> 
> +        	-- <1.1>

1. Git highligts this line with red. I assume here is an inconsistency
between tabs and spaces. But it does not matter as these comments can
be dropped. They are useless artifacts of TCL -> Lua translation.

>          	-- </1.1>
>      })
> diff --git a/test/sql-tap/join.test.lua b/test/sql-tap/join.test.lua
> index 1fc968307..4175608fd 100755
> --- a/test/sql-tap/join.test.lua
> +++ b/test/sql-tap/join.test.lua
> @@ -564,6 +564,7 @@ test:do_catchsql_test(
>          -- </join-3.4.2>
>      })
>  
> +-- luacheck: ignore

2. Why? You couldn't delete some whitespaces here?
Or what is the issue?

>  test:do_catchsql_test(
>      "join-3.5",
>      [[
> diff --git a/test/sql-tap/tkt3935.test.lua b/test/sql-tap/tkt3935.test.lua
> index 7138e9e6a..f3bbe0b9f 100755
> --- a/test/sql-tap/tkt3935.test.lua
> +++ b/test/sql-tap/tkt3935.test.lua
> @@ -27,30 +27,31 @@ test:do_execsql_test(
>          CREATE TABLE t2(c INT primary key, d INT);
>      ]], {
>          -- <tkt3935.1>
> -        
> +
>          -- </tkt3935.1>
>      })
>  
>  test:do_execsql_test(
>      "tkt3935.2",
>      [[
> -        SELECT j1.b FROM ( SELECT * FROM t1 INNER JOIN t2 ON a=c ) AS j1 
> +        SELECT j1.b FROM ( SELECT * FROM t1 INNER JOIN t2 ON a=c ) AS j1
>      ]], {
>          -- <tkt3935.2>
> -        
> +
>          -- </tkt3935.2>
>      })
>  
>  test:do_execsql_test(
>      "tkt3935.3",
>      [[
> -        SELECT j1.b FROM (t1 INNER JOIN t2 ON a=c) AS j1 
> +        SELECT j1.b FROM (t1 INNER JOIN t2 ON a=c) AS j1
>      ]], {
>          -- <tkt3935.3>
> -        
> +
>          -- </tkt3935.3>
>      })
>  
> +-- luacheck: ignore

3. The same question as in the previous comment.

>  test:do_catchsql_test(
>      "tkt3935.4",
>      [[

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 13/14] test: fix luacheck warnings W621 in test/sql-tap
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 13/14] test: fix luacheck warnings W621 " Sergey Bronnikov via Tarantool-patches
@ 2021-01-24 17:37   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-29 16:11     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-01-24 17:37 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Thanks for the patch!

See 2 comments below.

On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> W621 (Inconsistent indentation (SPACE followed by TAB))
> 
> Part of #5464
> ---
> diff --git a/test/sql-tap/analyze7.test.lua b/test/sql-tap/analyze7.test.lua
> index 203a0c3f9..8aa29e951 100755
> --- a/test/sql-tap/analyze7.test.lua
> +++ b/test/sql-tap/analyze7.test.lua
> @@ -29,11 +29,11 @@ test:do_test(
>  		    DROP TABLE IF EXISTS nums;
>  			CREATE TABLE nums(n  INT PRIMARY KEY);
>  			INSERT into nums WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<256) SELECT x FROM cnt;
> - 			INSERT INTO t1 SELECT n, n, n, n/100, n FROM nums;
> - 			EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=123;
> +                        INSERT INTO t1 SELECT n, n, n, n/100, n FROM nums;
> +                        EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=123;
>  		]])
>  		end, {
> -        	-- <analyze7-1.0>
> +                -- <analyze7-1.0>

1. This is now misaligned with the next comment.

>              0, 0, 0, "SEARCH TABLE T1 USING COVERING INDEX T1A (A=?)"
>              -- </analyze7-1.0>
>          })
> diff --git a/test/sql-tap/analyzeD.test.lua b/test/sql-tap/analyzeD.test.lua
> index e0426b974..c6b9fa206 100755
> --- a/test/sql-tap/analyzeD.test.lua
> +++ b/test/sql-tap/analyzeD.test.lua
> @@ -54,8 +54,8 @@ test:do_test(
>  			ANALYZE;
>  		]])
>  	end, {
> -        	-- <1.1>
> -        	-- </1.1>
> +                -- <1.1>
> +                -- </1.1>

2. You can drop both lines. They are not necessary
for anything.

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 14/14] luacheck: add issues for suppressed warnings
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 14/14] luacheck: add issues for suppressed warnings Sergey Bronnikov via Tarantool-patches
@ 2021-01-24 17:37   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-29 16:13     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-01-24 17:37 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Thanks for the patch!

On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> Closes #5464
> ---
>  .luacheckrc | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index a798ca6f8..597988367 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -52,8 +52,10 @@ exclude_files = {
>  files["test/sql-tap/**/*.lua"] = {
>      ignore = {
>          -- A line consists of nothing but whitespace.
> +        -- https://github.com/tarantool/tarantool/issues/5739

Why can't you fix this one now? Is it so hard that it is
worth adding a special issue for it? Doesn't the whole work
consists of removing a bunch of empty lines or whitespaces
from these lines?

>          "611",
>          -- Line is too long.
> +        -- https://github.com/tarantool/tarantool/issues/5181
>          "631"
>      }
>  }
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 13/14] test: fix luacheck warnings W621 in test/sql-tap
  2021-01-24 17:37   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-01-29 16:11     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-29 16:11 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Thanks for review!

On 24.01.2021 20:37, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> See 2 comments below.
>
> On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb@tarantool.org>
>>
>> W621 (Inconsistent indentation (SPACE followed by TAB))
>>
>> Part of #5464
>> ---
>> diff --git a/test/sql-tap/analyze7.test.lua b/test/sql-tap/analyze7.test.lua
>> index 203a0c3f9..8aa29e951 100755
>> --- a/test/sql-tap/analyze7.test.lua
>> +++ b/test/sql-tap/analyze7.test.lua
>> @@ -29,11 +29,11 @@ test:do_test(
>>   		    DROP TABLE IF EXISTS nums;
>>   			CREATE TABLE nums(n  INT PRIMARY KEY);
>>   			INSERT into nums WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<256) SELECT x FROM cnt;
>> - 			INSERT INTO t1 SELECT n, n, n, n/100, n FROM nums;
>> - 			EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=123;
>> +                        INSERT INTO t1 SELECT n, n, n, n/100, n FROM nums;
>> +                        EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=123;
>>   		]])
>>   		end, {
>> -        	-- <analyze7-1.0>
>> +                -- <analyze7-1.0>
> 1. This is now misaligned with the next comment.

Reverted


--- a/test/sql-tap/analyze7.test.lua
+++ b/test/sql-tap/analyze7.test.lua
@@ -33,7 +33,7 @@ test:do_test(
                          EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=123;
                 ]])
                 end, {
-                -- <analyze7-1.0>
+               -- <analyze7-1.0>
              0, 0, 0, "SEARCH TABLE T1 USING COVERING INDEX T1A (A=?)"
              -- </analyze7-1.0>
          })

>
>>               0, 0, 0, "SEARCH TABLE T1 USING COVERING INDEX T1A (A=?)"
>>               -- </analyze7-1.0>
>>           })
>> diff --git a/test/sql-tap/analyzeD.test.lua b/test/sql-tap/analyzeD.test.lua
>> index e0426b974..c6b9fa206 100755
>> --- a/test/sql-tap/analyzeD.test.lua
>> +++ b/test/sql-tap/analyzeD.test.lua
>> @@ -54,8 +54,8 @@ test:do_test(
>>   			ANALYZE;
>>   		]])
>>   	end, {
>> -        	-- <1.1>
>> -        	-- </1.1>
>> +                -- <1.1>
>> +                -- </1.1>
> 2. You can drop both lines. They are not necessary
> for anything.

Removed


--- a/test/sql-tap/analyzeD.test.lua
+++ b/test/sql-tap/analyzeD.test.lua
@@ -54,8 +54,6 @@ test:do_test(
                         ANALYZE;
                 ]])
         end, {
-                -- <1.1>
-                -- </1.1>
      })

  -- With full ANALYZE data, sql sees that c=150 (5 rows) is better than


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 14/14] luacheck: add issues for suppressed warnings
  2021-01-24 17:37   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-01-29 16:13     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-29 16:13 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Thanks for review!

On 24.01.2021 20:37, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb@tarantool.org>
>>
>> Closes #5464
>> ---
>>   .luacheckrc | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/.luacheckrc b/.luacheckrc
>> index a798ca6f8..597988367 100644
>> --- a/.luacheckrc
>> +++ b/.luacheckrc
>> @@ -52,8 +52,10 @@ exclude_files = {
>>   files["test/sql-tap/**/*.lua"] = {
>>       ignore = {
>>           -- A line consists of nothing but whitespace.
>> +        -- https://github.com/tarantool/tarantool/issues/5739
> Why can't you fix this one now? Is it so hard that it is
> worth adding a special issue for it? Doesn't the whole work
> consists of removing a bunch of empty lines or whitespaces
> from these lines?

I can. luacheck reported about 1k warnings of this type

and I was worried that it would be difficult to review.

Added new commit with fixes for W611.

>>           "611",
>>           -- Line is too long.
>> +        -- https://github.com/tarantool/tarantool/issues/5181
>>           "631"
>>       }
>>   }
>>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 12/14] test: fix luacheck warnings W612, W613, W614 in test/sql-tap
  2021-01-24 17:36   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-01-29 16:23     ` Sergey Bronnikov via Tarantool-patches
  2021-01-29 21:50       ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-29 16:23 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Thanks for review!

On 24.01.2021 20:36, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> See 3 comments below.
>
> On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb@tarantool.org>
>>
>> W612 (A line contains trailing whitespace)
>> W613 (Trailing whitespace in a string)
>> W614 (Trailing whitespace in a comment)
>>
>> Note: changes were made automatically in vim with regexp "%s/\s\+$//e".
>>
>> Part of #5464
>> ---
>> diff --git a/test/sql-tap/analyzeD.test.lua b/test/sql-tap/analyzeD.test.lua
>> index 12722a3d4..e0426b974 100755
>> --- a/test/sql-tap/analyzeD.test.lua
>> +++ b/test/sql-tap/analyzeD.test.lua
>> @@ -54,7 +54,7 @@ test:do_test(
>>   			ANALYZE;
>>   		]])
>>   	end, {
>> -        	-- <1.1>
>> +        	-- <1.1>
> 1. Git highligts this line with red. I assume here is an inconsistency
> between tabs and spaces. But it does not matter as these comments can
> be dropped. They are useless artifacts of TCL -> Lua translation.

Removed


--- a/test/sql-tap/analyzeD.test.lua
+++ b/test/sql-tap/analyzeD.test.lua
@@ -54,8 +54,6 @@ test:do_test(
                         ANALYZE;
                 ]])
         end, {
-               -- <1.1>
-               -- </1.1>
      })

  -- With full ANALYZE data, sql sees that c=150 (5 rows) is better than

>>           	-- </1.1>
>>       })
>> diff --git a/test/sql-tap/join.test.lua b/test/sql-tap/join.test.lua
>> index 1fc968307..4175608fd 100755
>> --- a/test/sql-tap/join.test.lua
>> +++ b/test/sql-tap/join.test.lua
>> @@ -564,6 +564,7 @@ test:do_catchsql_test(
>>           -- </join-3.4.2>
>>       })
>>   
>> +-- luacheck: ignore
> 2. Why? You couldn't delete some whitespaces here?
> Or what is the issue?
--- a/test/sql-tap/join.test.lua
+++ b/test/sql-tap/join.test.lua
@@ -564,11 +564,10 @@ test:do_catchsql_test(
          -- </join-3.4.2>
      })

--- luacheck: ignore
  test:do_catchsql_test(
      "join-3.5",
      [[
-        SELECT * FROM t1 USING(a)
+        SELECT * FROM t1 USING(a)
      ]], {
          -- <join-3.5>
          1, "Syntax error at line 1 at or near position 40: a JOIN 
clause is required before ON and USING"

>
>>   test:do_catchsql_test(
>>       "join-3.5",
>>       [[
>> diff --git a/test/sql-tap/tkt3935.test.lua b/test/sql-tap/tkt3935.test.lua
>> index 7138e9e6a..f3bbe0b9f 100755
>> --- a/test/sql-tap/tkt3935.test.lua
>> +++ b/test/sql-tap/tkt3935.test.lua
>> @@ -27,30 +27,31 @@ test:do_execsql_test(
>>           CREATE TABLE t2(c INT primary key, d INT);
>>       ]], {
>>           -- <tkt3935.1>
>> -
>> +
>>           -- </tkt3935.1>
>>       })
>>   
>>   test:do_execsql_test(
>>       "tkt3935.2",
>>       [[
>> -        SELECT j1.b FROM ( SELECT * FROM t1 INNER JOIN t2 ON a=c ) AS j1
>> +        SELECT j1.b FROM ( SELECT * FROM t1 INNER JOIN t2 ON a=c ) AS j1
>>       ]], {
>>           -- <tkt3935.2>
>> -
>> +
>>           -- </tkt3935.2>
>>       })
>>   
>>   test:do_execsql_test(
>>       "tkt3935.3",
>>       [[
>> -        SELECT j1.b FROM (t1 INNER JOIN t2 ON a=c) AS j1
>> +        SELECT j1.b FROM (t1 INNER JOIN t2 ON a=c) AS j1
>>       ]], {
>>           -- <tkt3935.3>
>> -
>> +
>>           -- </tkt3935.3>
>>       })
>>   
>> +-- luacheck: ignore
> 3. The same question as in the previous comment.

Fixed.


--- a/test/sql-tap/tkt3935.test.lua
+++ b/test/sql-tap/tkt3935.test.lua
@@ -51,77 +51,70 @@ test:do_execsql_test(
          -- </tkt3935.3>
      })

--- luacheck: ignore
  test:do_catchsql_test(
      "tkt3935.4",
      [[
-        SELECT a FROM (t1) AS t ON b USING(a)
+        SELECT a FROM (t1) AS t ON b USING(a)
      ]], {
          -- <tkt3935.4>
          1, "Syntax error at line 1 at or near position 52: a JOIN 
clause is required before ON and USING"
          -- </tkt3935.4>
      })

--- luacheck: ignore
  test:do_catchsql_test(
      "tkt3935.5",
      [[
-        SELECT a FROM (t1) AS t ON b
+        SELECT a FROM (t1) AS t ON b
      ]], {
          -- <tkt3935.5>
          1, "Syntax error at line 1 at or near position 43: a JOIN 
clause is required before ON and USING"
          -- </tkt3935.5>
      })

--- luacheck: ignore
  test:do_catchsql_test(
      "tkt3935.6",
      [[
-        SELECT a FROM (SELECT * FROM t1) AS t ON b USING(a)
+        SELECT a FROM (SELECT * FROM t1) AS t ON b USING(a)
      ]], {
          -- <tkt3935.6>
          1, "Syntax error at line 1 at or near position 66: a JOIN 
clause is required before ON and USING"
          -- </tkt3935.6>
      })

--- luacheck: ignore
  test:do_catchsql_test(
      "tkt3935.7",
      [[
-        SELECT a FROM (SELECT * FROM t1) AS t ON b
+        SELECT a FROM (SELECT * FROM t1) AS t ON b
      ]], {
          -- <tkt3935.7>
          1, "Syntax error at line 1 at or near position 57: a JOIN 
clause is required before ON and USING"
          -- </tkt3935.7>
      })

--- luacheck: ignore
  test:do_catchsql_test(
      "tkt3935.8",
      [[
-        SELECT a FROM t1 AS t ON b
+        SELECT a FROM t1 AS t ON b
      ]], {
          -- <tkt3935.8>
          1, "Syntax error at line 1 at or near position 41: a JOIN 
clause is required before ON and USING"
          -- </tkt3935.8>
      })


--- luacheck: ignore
  test:do_catchsql_test(
      "tkt3935.9",
      [[
-        SELECT a FROM t1 AS t ON b USING(a)
+        SELECT a FROM t1 AS t ON b USING(a)
      ]], {
          -- <tkt3935.9>
          1, "Syntax error at line 1 at or near position 50: a JOIN 
clause is required before ON and USING"
          -- </tkt3935.9>
      })

--- luacheck: ignore
  test:do_catchsql_test(
      "tkt3935.10",
      [[
-        SELECT a FROM t1 AS t USING(a)
+        SELECT a FROM t1 AS t USING(a)
      ]], {
          -- <tkt3935.10>
          1, "Syntax error at line 1 at or near position 45: a JOIN 
clause is required before ON and USING"

>
>>   test:do_catchsql_test(
>>       "tkt3935.4",
>>       [[

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 06/14] test: fix laucheck warnings W213 in test/sql-tap
  2021-01-24 17:35   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-01-29 16:32     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-29 16:32 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Thanks for review!

On 24.01.2021 20:35, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb@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;
              ]]


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 12/14] test: fix luacheck warnings W612, W613, W614 in test/sql-tap
  2021-01-29 16:23     ` Sergey Bronnikov via Tarantool-patches
@ 2021-01-29 21:50       ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-29 21:50 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches


On 29.01.2021 19:23, Sergey Bronnikov wrote:
> Thanks for review!
>
> On 24.01.2021 20:36, Vladislav Shpilevoy wrote:
>> Thanks for the patch!
>>
>> See 3 comments below.
>>
>> On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
>>> From: Sergey Bronnikov <sergeyb@tarantool.org>
>>>
>>> W612 (A line contains trailing whitespace)
>>> W613 (Trailing whitespace in a string)
>>> W614 (Trailing whitespace in a comment)
>>>
>>> Note: changes were made automatically in vim with regexp "%s/\s\+$//e".
>>>
>>> Part of #5464
>>> ---
>>> diff --git a/test/sql-tap/analyzeD.test.lua 
>>> b/test/sql-tap/analyzeD.test.lua
>>> index 12722a3d4..e0426b974 100755
>>> --- a/test/sql-tap/analyzeD.test.lua
>>> +++ b/test/sql-tap/analyzeD.test.lua
>>> @@ -54,7 +54,7 @@ test:do_test(
>>>               ANALYZE;
>>>           ]])
>>>       end, {
>>> -            -- <1.1>
>>> +            -- <1.1>
>> 1. Git highligts this line with red. I assume here is an inconsistency
>> between tabs and spaces. But it does not matter as these comments can
>> be dropped. They are useless artifacts of TCL -> Lua translation.
>
> Removed
>
<snipped>


Some testcases in test/sql-tap/tkt3935.test.lua and 
test/sql-tap/join.test.lua fails when trailing whitespace removed in SQL 
command line,

so expected output line has been updated too where it was required.


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 07/14] test: fix luacheck warnings W231 in test/sql-tap
  2021-01-24 17:35   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-01-29 22:39     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-29 22:39 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Thanks for review!

On 24.01.2021 20:35, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> On 21.01.2021 13:50, sergeyb@tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb@tarantool.org>
>>
>> W231 (Local variable is set but never accessed)
>>
>> Part of #5464
>> ---
>> diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
>> index 5f8b206d3..b488bdc60 100755
>> --- a/test/sql-tap/e_expr.test.lua
>> +++ b/test/sql-tap/e_expr.test.lua
>> @@ -2554,9 +2550,6 @@ test:do_test(
>>   -- evaluation of the THEN expression that corresponds to the first WHEN
>>   -- expression that evaluates to true.
>>   --
>> -a = 0
>> -b = 1
>> -c = 0
> These look like an artifact of a wrong conversion from TCL to Lua.
> The variables are used in the SQL statements. I think the converter
> thought it could just declare them as Lua variables to make visible
> in SQL. Better keep them and add MUST_WORK_TEST if it is not here yet.

Reverted changes with removing variables and added luacheck inline 
suppression:

--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,6 @@ exclude_files = {

  files["test/sql-tap/**/*.lua"] = {
      ignore = {
-        -- Local variable is set but never accessed.
-        "231",
          -- "Value assigned to a local variable is unused."
          "311",
          -- Unreachable code.
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index 5f8b206d3..5ecd7b7ae 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -2486,7 +2486,7 @@ test:do_execsql_test(
          -- </e_expr-20.2>
      })

-local a, b, c
+local a, b, c -- luacheck: ignore unused a b c
  a = 0
  b = 0
  c = 0

What does comment with MUST_WORK_TEST mean?

> So in future we would see the expected variable values, and either
> decide fix the tests or delete them entirely. The latter can easily
> happen due to how much the type system was reworked.
>
>>   test:do_execsql_test(
>>       "e_expr-21.2.1",
>>       [[

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
  2021-01-24 17:33   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-02-06 17:52     ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-16 12:02     ` Sergey Bronnikov via Tarantool-patches
  1 sibling, 0 replies; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-02-06 17:52 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Hi! Did you see this response and some of the others?

On 24.01.2021 18:33, Vladislav Shpilevoy via Tarantool-patches wrote:
> Hi! Thanks for the patch!
> 
> See 3 comments below.
> 
> On 21.01.2021 13:49, sergeyb@tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb@tarantool.org>
>>
>> W113 (Accessing an undefined global variable)
>>
>> Part of #5464
>> ---
>>  .luacheckrc                    |  37 +++++++++-
>>  test/sql-tap/badutf1.test.lua  |  10 ++-
>>  test/sql-tap/index1.test.lua   |   2 +-
>>  test/sql-tap/lua/sqltester.lua |   2 +-
>>  test/sql-tap/lua_sql.test.lua  |   6 +-
>>  test/sql-tap/minmax2.test.lua  |   2 +
>>  test/sql-tap/select1.test.lua  |   4 ++
>>  test/sql-tap/subquery.test.lua |   7 +-
>>  test/sql-tap/table.test.lua    |   6 +-
>>  test/sql-tap/tkt1443.test.lua  |   2 +-
>>  test/sql-tap/trigger9.test.lua |   1 +
>>  test/sql-tap/triggerC.test.lua |   1 -
>>  test/sql-tap/view.test.lua     | 126 +++++++++++++++------------------
>>  13 files changed, 122 insertions(+), 84 deletions(-)
>>
>> diff --git a/.luacheckrc b/.luacheckrc
>> index 81aa61a2b..eb709d6a3 100644
>> --- a/.luacheckrc
>> +++ b/.luacheckrc
>> @@ -124,3 +122,38 @@ files["test/box-tap/extended_error.test.lua"] = {
>>          "forbidden_function",
>>      },
>>  }
>> +files["test/sql-tap/analyze5.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/cast.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/func.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/e_expr.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/e_select1.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/misc1.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/sort.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
> 
> 1. The commit title says "fix", but it does not look like a fix.
> I suggest you to try harder to remove the warnings, not hide them.
> For example, analyze5 can be fixed like this:
> 
> ====================
> diff --git a/.luacheckrc b/.luacheckrc
> index eb709d6a3..977eb2945 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -122,11 +122,6 @@ files["test/box-tap/extended_error.test.lua"] = {
>          "forbidden_function",
>      },
>  }
> -files["test/sql-tap/analyze5.test.lua"] = {
> -    ignore = {
> -        "113",
> -    },
> -}
>  files["test/sql-tap/cast.test.lua"] = {
>      ignore = {
>          "113",
> diff --git a/test/sql-tap/analyze5.test.lua b/test/sql-tap/analyze5.test.lua
> index 1d6665ad0..a9eb4dd2f 100755
> --- a/test/sql-tap/analyze5.test.lua
> +++ b/test/sql-tap/analyze5.test.lua
> @@ -26,6 +26,8 @@ local function eqp(sql)
>      return test:execsql("EXPLAIN QUERY PLAN"..sql)
>  end
>  
> +local X = nil
> +
>  local function alpha(blob)
>      local ret = ""
>      for _, c in ipairs(X(37, "X!cmd", [=[["split",["blob"],""]]=])) do
> @@ -155,6 +157,9 @@ test:do_test(
>  
>  -- Verify that range queries generate the correct row count estimates
>  --
> +local t1x = nil
> +local t1y = nil
> +local t1z = nil
>  for i, v in pairs({
>  {'z>=0 AND z<=0',      t1z,  400},
>  {'z>=1 AND z<=1',      t1z,  300},
> ====================
> 
> It does not make much sense, and the whole test does not make it, because
> it is disabled. But it is better than just move the ignores from one
> place to another. At least now they are local to the disabled places,
> not to the whole file.
> 
> Cast.test.lua:
> 
> ====================
> diff --git a/.luacheckrc b/.luacheckrc
> index eb709d6a3..15944e378 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -127,11 +127,6 @@ files["test/sql-tap/analyze5.test.lua"] = {
>          "113",
>      },
>  }
> -files["test/sql-tap/cast.test.lua"] = {
> -    ignore = {
> -        "113",
> -    },
> -}
>  files["test/sql-tap/func.test.lua"] = {
>      ignore = {
>          "113",
> diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
> index 4d7c92cfc..bcee65d9b 100755
> --- a/test/sql-tap/cast.test.lua
> +++ b/test/sql-tap/cast.test.lua
> @@ -786,13 +786,19 @@ test:do_execsql_test(
>  -- Test to see if it is possible to trick sql into reading past
>  -- the end of a blob when converting it to a number.
>  if 0 > 0 then
> +-- Legacy from the original code. Must be replaced with analogue
> +-- functions from box.
> +local sql_prepare = nil
> +local sql_bind_blob = nil
> +local sql_step = nil
> +local sql_column_int = nil
> +local STMT
>  test:do_test(
>      "cast-3.32.1",
>      function()
> -        local blob, DB, STMT
> +        local blob
>          blob = 1234567890
> -        DB = sql_connection_pointer("db")
> -        STMT = sql_prepare(DB, "SELECT CAST(? AS NUMBER)", -1, "TAIL")
> +        STMT = sql_prepare("SELECT CAST(? AS NUMBER)", -1, "TAIL")
>          sql_bind_blob("-static", STMT, 1, blob, 5)
>          return sql_step(STMT)
>      end, {
> ====================
> 
> Func.test.lua:
> 
> ====================
> diff --git a/.luacheckrc b/.luacheckrc
> index eb709d6a3..7608240c5 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -132,11 +132,6 @@ files["test/sql-tap/cast.test.lua"] = {
>          "113",
>      },
>  }
> -files["test/sql-tap/func.test.lua"] = {
> -    ignore = {
> -        "113",
> -    },
> -}
>  files["test/sql-tap/e_expr.test.lua"] = {
>      ignore = {
>          "113",
> diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
> index d14eef421..a83b15fbc 100755
> --- a/test/sql-tap/func.test.lua
> +++ b/test/sql-tap/func.test.lua
> @@ -1048,7 +1048,8 @@ test:do_execsql_test(
>  --
>  -- MUST_WORK_TEST testfunc not implemented
>  if 0 > 0 then
> -local DB = sql_connection_pointer("db")
> +local DB = nil
> +local X = nil
>  X(525, "X!cmd", [=[["sql_register_test_function",["::DB"],"testfunc"]]=])
>  test:do_catchsql_test(
>      "func-10.1",
> @@ -1142,6 +1143,18 @@ end
>  --
>  -- MUST_WORK_TEST test_destructor_count not implemented
>  if 0 > 0 then
> +local X = nil
> +-- Legacy from the original code. Must be replaced with analogue
> +-- functions from box.
> +local sql_prepare = nil
> +local sql_bind_text = nil
> +local sql_bind_blob = nil
> +local sql_column_text = nil
> +local sql_step = nil
> +local sql_finalize = nil
> +local db = nil
> +local STMT
> +
>  if X(595, "X!cmd", "[\"expr\",\"[db eval {PRAGMA encoding}]==\\\"UTF-8\\\"\"]")
>   then
>      test:do_execsql_test(
> @@ -1300,10 +1313,9 @@ test:do_execsql_test(
>  test:do_test(
>      "func-13.7",
>      function()
> -        local DB, sql, STMT, res
> -        DB = sql_connection_pointer("db")
> +        local sql, STMT, res
>          sql = "SELECT test_auxdata( ? , a ) FROM t4;"
> -        STMT = sql_prepare(DB, sql, -1, "TAIL")
> +        STMT = sql_prepare(sql, -1, "TAIL")
>          sql_bind_text(STMT, 1, "hello\0", -1)
>          res = {  }
>          while X(690, "X!cmd", [=[["expr"," \"sql_ROW\"==[sql_step $STMT] "]]=])
> @@ -1455,7 +1467,7 @@ test:do_test(
>          test:execsql([[
>              CREATE TABLE tbl2(id integer primary key, a INT, b INT);
>          ]])
> -        local STMT = sql_prepare(DB, "INSERT INTO tbl2 VALUES(1, ?, ?)", -1, "TAIL")
> +        local STMT = sql_prepare("INSERT INTO tbl2 VALUES(1, ?, ?)", -1, "TAIL")
>          sql_bind_blob(STMT, 1, "abc", 3)
>          sql_step(STMT)
>          sql_finalize(STMT)
> @@ -2439,6 +2451,7 @@ test:do_execsql_test(
>  --
>  -- MUST_WORK_TEST
>  if 0>0 then
> +local X = nil
>  test:do_execsql_test(
>      "func-25.1",
>      [[
> @@ -2470,7 +2483,7 @@ test:do_test(
>      "func-26.2",
>      function()
>          local a = ""
> -        for _ in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG","incr i"]]=]) do
> +        for i in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG","incr i"]]=]) do
>              table.insert(a,i)
>          end
>          return test:execsql(string.format([[
> @@ -2486,7 +2499,7 @@ test:do_test(
>      "func-26.3",
>      function()
>          local a = ""
> -        for _ in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG+1","incr i"]]=]) do
> +        for i in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG+1","incr i"]]=]) do
>              table.insert(a,i)
>          end
>          return test:catchsql(string.format([[
> @@ -2502,7 +2515,7 @@ test:do_test(
>      "func-26.4",
>      function()
>          local a = ""
> -        for _ in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG-1","incr i"]]=]) do
> +        for i in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG-1","incr i"]]=]) do
>              table.insert(a,i)
>          end
>          return test:catchsql(string.format([[
> ====================
> 
> I am sure the other files also can be properly fixed, with stubs
> and comments for legacy old functions, and with normal fixes for
> the things like in the last lines of the diff above, where it was
> a real bug - loop variable was not defined.
> 
>> diff --git a/test/sql-tap/badutf1.test.lua b/test/sql-tap/badutf1.test.lua
>> index 654629bf7..b7fa8ce0b 100755
>> --- a/test/sql-tap/badutf1.test.lua
>> +++ b/test/sql-tap/badutf1.test.lua
>> @@ -93,8 +93,12 @@ test:do_test(
>>      })
>>  
>>  -- commented as it uses utf16
>> -if 0>0 then
>> -sql("db2", "")
>> +-- testcases are broken
>> +-- https://github.com/tarantool/tarantool/issues/5743
>> +local is_gh_5743_closed = false
>> +if is_gh_5743_closed then
>> +sql("db2", "") -- luacheck: ignore sql
>> +-- luacheck: push ignore sql_exec
> 
> 2. Or you can use 'local sql_exec = nil', and won't need to
> write 'pop'.
> 
> The same to the other places, where you try to ignore the same
> unknown variable again and again. However I don't insist on
> hacks vs luacheck comments.
> 
>>  test:do_test(
>>      "badutf-1.10",
>>      function()
>> @@ -206,7 +210,7 @@ test:do_test(
>>          -- </badutf-1.20>
>>      })
>>  end
>> -
>> +-- luacheck: pop
>>  > diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua
>> index 2f1af29b0..67f461132 100755
>> --- a/test/sql-tap/view.test.lua
>> +++ b/test/sql-tap/view.test.lua
>> @@ -1,6 +1,6 @@
>>  #!/usr/bin/env tarantool
>>  local test = require("sqltester")
>> -test:plan(78)
>> +test:plan(83)
>>  
>>  --!./tcltestrunner.lua
>>  -- 2002 February 26
>> @@ -501,21 +501,18 @@ test:do_execsql_test(
>>      })
>>  
>>  -- MUST_WORK_TEST
> 
> 3. Why did you keep MUST_WORK_TEST, if it passes now?
> The same in other places below.
> 
>> -if (0 > 0)
>> - then
>> -    test:do_test(
>> -        "view-7.2",
>> -        function()
>> -            return test:execsql [[
>> -                SELECT * FROM test;
>> -            ]]
>> -        end, {
>> -            -- <view-7.2>
>> -            1, 2, 3
>> -            -- </view-7.2>
>> -        })
>> +test:do_test(
>> +    "view-7.2",
>> +    function()
>> +        return test:execsql [[
>> +            SELECT * FROM test;
>> +        ]]
>> +    end, {
>> +        -- <view-7.2>
>> +        1, 2, 3
>> +        -- </view-7.2>
>> +    })
>>  
>> -end
>>  test:do_execsql_test(
>>      "view-7.3",
>>      [[
>> @@ -531,21 +528,18 @@ test:do_execsql_test(
>>      })
>>  
>>  -- MUST_WORK_TEST
>> -if (0 > 0)
>> - then
>> -    test:do_test(
>> -        "view-7.4",
>> -        function()
>> -            return test:execsql [[
>> -                SELECT * FROM test;
>> -            ]]
>> -        end, {
>> -            -- <view-7.4>
>> -            1, 2, 3
>> -            -- </view-7.4>
>> -        })
>> +test:do_test(
>> +    "view-7.4",
>> +    function()
>> +        return test:execsql [[
>> +            SELECT * FROM test;
>> +        ]]
>> +    end, {
>> +        -- <view-7.4>
>> +        1, 2, 3
>> +        -- </view-7.4>
>> +    })
>>  
>> -end
>>  test:do_execsql_test(
>>      "view-7.5",
>>      [[
>> @@ -561,21 +555,18 @@ test:do_execsql_test(
>>      })
>>  
>>  -- MUST_WORK_TEST
>> -if (0 > 0)
>> - then
>> -    test:do_test(
>> -        "view-7.6",
>> -        function()
>> -            return test:execsql [[
>> -                SELECT * FROM test;
>> -            ]]
>> -        end, {
>> -            -- <view-7.6>
>> -            1, 2, 3
>> -            -- </view-7.6>
>> -        })
>> +test:do_test(
>> +    "view-7.6",
>> +    function()
>> +        return test:execsql [[
>> +            SELECT * FROM test;
>> +        ]]
>> +    end, {
>> +        -- <view-7.6>
>> +        1, 2, 3
>> +        -- </view-7.6>
>> +    })
>>  
>> -end
>>  test:do_execsql_test(
>>      "view-8.1",
>>      [[
>> @@ -588,33 +579,29 @@ test:do_execsql_test(
>>      })
>>  
>>  -- MUST_WORK_TEST
>> -if (0 > 0)
>> - then
>> -    test:do_test(
>> -        "view-8.2",
>> -        function()
>> -            return test:execsql [[
>> -                SELECT * FROM v6 ORDER BY xyz;
>> -            ]]
>> -        end, {
>> -            -- <view-8.2>
>> -            7, 2, 13, 5, 19, 8, 27, 12
>> -            -- </view-8.2>
>> -        })
>> -
>> -    -- MUST_WORK_TEST problem with column names
>> -    test:do_execsql_test(
>> -        "view-8.3",
>> -        [[
>> -            CREATE VIEW v7(a) AS SELECT pqr+xyz FROM v6;
>> -            SELECT * FROM v7 ORDER BY a;
>> -        ]], {
>> -            -- <view-8.3>
>> -            9, 18, 27, 39
>> -            -- </view-8.3>
>> -        })
>> +test:do_test(
>> +    "view-8.2",
>> +    function()
>> +        return test:execsql [[
>> +            SELECT * FROM v6 ORDER BY xyz;
>> +        ]]
>> +    end, {
>> +        -- <view-8.2>
>> +        7, 2, 13, 5, 19, 8, 27, 12
>> +        -- </view-8.2>
>> +    })
>>  
>> -end
>> +-- MUST_WORK_TEST problem with column names
>> +test:do_execsql_test(
>> +    "view-8.3",
>> +    [[
>> +        CREATE VIEW v7(a) AS SELECT pqr+xyz FROM v6;
>> +        SELECT * FROM v7 ORDER BY a;
>> +    ]], {
>> +        -- <view-8.3>
>> +        9, 18, 27, 39
>> +        -- </view-8.3>
>> +    })
>>  
>>  test:do_execsql_test(
>>      "view-8.4",

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
  2021-01-24 17:33   ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-06 17:52     ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-02-16 12:02     ` Sergey Bronnikov via Tarantool-patches
  2021-02-23 21:25       ` Vladislav Shpilevoy via Tarantool-patches
  1 sibling, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-02-16 12:02 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Hi, thanks for review!

On 24.01.2021 20:33, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch!
>
> See 3 comments below.
>
> On 21.01.2021 13:49, sergeyb@tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb@tarantool.org>
>>
>> W113 (Accessing an undefined global variable)
>>
>> Part of #5464
>> ---
>>   .luacheckrc                    |  37 +++++++++-
>>   test/sql-tap/badutf1.test.lua  |  10 ++-
>>   test/sql-tap/index1.test.lua   |   2 +-
>>   test/sql-tap/lua/sqltester.lua |   2 +-
>>   test/sql-tap/lua_sql.test.lua  |   6 +-
>>   test/sql-tap/minmax2.test.lua  |   2 +
>>   test/sql-tap/select1.test.lua  |   4 ++
>>   test/sql-tap/subquery.test.lua |   7 +-
>>   test/sql-tap/table.test.lua    |   6 +-
>>   test/sql-tap/tkt1443.test.lua  |   2 +-
>>   test/sql-tap/trigger9.test.lua |   1 +
>>   test/sql-tap/triggerC.test.lua |   1 -
>>   test/sql-tap/view.test.lua     | 126 +++++++++++++++------------------
>>   13 files changed, 122 insertions(+), 84 deletions(-)
>>
>> diff --git a/.luacheckrc b/.luacheckrc
>> index 81aa61a2b..eb709d6a3 100644
>> --- a/.luacheckrc
>> +++ b/.luacheckrc
>> @@ -124,3 +122,38 @@ files["test/box-tap/extended_error.test.lua"] = {
>>           "forbidden_function",
>>       },
>>   }
>> +files["test/sql-tap/analyze5.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/cast.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/func.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/e_expr.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/e_select1.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/misc1.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
>> +files["test/sql-tap/sort.test.lua"] = {
>> +    ignore = {
>> +        "113",
>> +    },
>> +}
> 1. The commit title says "fix", but it does not look like a fix.
> I suggest you to try harder to remove the warnings, not hide them.

> For example, analyze5 can be fixed like this:
>
> ====================
> diff --git a/.luacheckrc b/.luacheckrc
> index eb709d6a3..977eb2945 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -122,11 +122,6 @@ files["test/box-tap/extended_error.test.lua"] = {
>           "forbidden_function",
>       },
>   }
> -files["test/sql-tap/analyze5.test.lua"] = {
> -    ignore = {
> -        "113",
> -    },
> -}
>   files["test/sql-tap/cast.test.lua"] = {
>       ignore = {
>           "113",
> diff --git a/test/sql-tap/analyze5.test.lua b/test/sql-tap/analyze5.test.lua
> index 1d6665ad0..a9eb4dd2f 100755
> --- a/test/sql-tap/analyze5.test.lua
> +++ b/test/sql-tap/analyze5.test.lua
> @@ -26,6 +26,8 @@ local function eqp(sql)
>       return test:execsql("EXPLAIN QUERY PLAN"..sql)
>   end
>   
> +local X = nil
> +
>   local function alpha(blob)
>       local ret = ""
>       for _, c in ipairs(X(37, "X!cmd", [=[["split",["blob"],""]]=])) do
> @@ -155,6 +157,9 @@ test:do_test(
>   
>   -- Verify that range queries generate the correct row count estimates
>   --
> +local t1x = nil
> +local t1y = nil
> +local t1z = nil
>   for i, v in pairs({
>   {'z>=0 AND z<=0',      t1z,  400},
>   {'z>=1 AND z<=1',      t1z,  300},
> ====================
>
> It does not make much sense, and the whole test does not make it, because
> it is disabled. But it is better than just move the ignores from one
> place to another. At least now they are local to the disabled places,
> not to the whole file.
>
> Cast.test.lua:
>
> ====================
> diff --git a/.luacheckrc b/.luacheckrc
> index eb709d6a3..15944e378 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -127,11 +127,6 @@ files["test/sql-tap/analyze5.test.lua"] = {
>           "113",
>       },
>   }
> -files["test/sql-tap/cast.test.lua"] = {
> -    ignore = {
> -        "113",
> -    },
> -}
>   files["test/sql-tap/func.test.lua"] = {
>       ignore = {
>           "113",
> diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
> index 4d7c92cfc..bcee65d9b 100755
> --- a/test/sql-tap/cast.test.lua
> +++ b/test/sql-tap/cast.test.lua
> @@ -786,13 +786,19 @@ test:do_execsql_test(
>   -- Test to see if it is possible to trick sql into reading past
>   -- the end of a blob when converting it to a number.
>   if 0 > 0 then
> +-- Legacy from the original code. Must be replaced with analogue
> +-- functions from box.
> +local sql_prepare = nil
> +local sql_bind_blob = nil
> +local sql_step = nil
> +local sql_column_int = nil
> +local STMT
>   test:do_test(
>       "cast-3.32.1",
>       function()
> -        local blob, DB, STMT
> +        local blob
>           blob = 1234567890
> -        DB = sql_connection_pointer("db")
> -        STMT = sql_prepare(DB, "SELECT CAST(? AS NUMBER)", -1, "TAIL")
> +        STMT = sql_prepare("SELECT CAST(? AS NUMBER)", -1, "TAIL")
>           sql_bind_blob("-static", STMT, 1, blob, 5)
>           return sql_step(STMT)
>       end, {
> ====================
>
> Func.test.lua:
>
> ====================
> diff --git a/.luacheckrc b/.luacheckrc
> index eb709d6a3..7608240c5 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -132,11 +132,6 @@ files["test/sql-tap/cast.test.lua"] = {
>           "113",
>       },
>   }
> -files["test/sql-tap/func.test.lua"] = {
> -    ignore = {
> -        "113",
> -    },
> -}
>   files["test/sql-tap/e_expr.test.lua"] = {
>       ignore = {
>           "113",
> diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
> index d14eef421..a83b15fbc 100755
> --- a/test/sql-tap/func.test.lua
> +++ b/test/sql-tap/func.test.lua
> @@ -1048,7 +1048,8 @@ test:do_execsql_test(
>   --
>   -- MUST_WORK_TEST testfunc not implemented
>   if 0 > 0 then
> -local DB = sql_connection_pointer("db")
> +local DB = nil
> +local X = nil
>   X(525, "X!cmd", [=[["sql_register_test_function",["::DB"],"testfunc"]]=])
>   test:do_catchsql_test(
>       "func-10.1",
> @@ -1142,6 +1143,18 @@ end
>   --
>   -- MUST_WORK_TEST test_destructor_count not implemented
>   if 0 > 0 then
> +local X = nil
> +-- Legacy from the original code. Must be replaced with analogue
> +-- functions from box.
> +local sql_prepare = nil
> +local sql_bind_text = nil
> +local sql_bind_blob = nil
> +local sql_column_text = nil
> +local sql_step = nil
> +local sql_finalize = nil
> +local db = nil
> +local STMT
> +
>   if X(595, "X!cmd", "[\"expr\",\"[db eval {PRAGMA encoding}]==\\\"UTF-8\\\"\"]")
>    then
>       test:do_execsql_test(
> @@ -1300,10 +1313,9 @@ test:do_execsql_test(
>   test:do_test(
>       "func-13.7",
>       function()
> -        local DB, sql, STMT, res
> -        DB = sql_connection_pointer("db")
> +        local sql, STMT, res
>           sql = "SELECT test_auxdata( ? , a ) FROM t4;"
> -        STMT = sql_prepare(DB, sql, -1, "TAIL")
> +        STMT = sql_prepare(sql, -1, "TAIL")
>           sql_bind_text(STMT, 1, "hello\0", -1)
>           res = {  }
>           while X(690, "X!cmd", [=[["expr"," \"sql_ROW\"==[sql_step $STMT] "]]=])
> @@ -1455,7 +1467,7 @@ test:do_test(
>           test:execsql([[
>               CREATE TABLE tbl2(id integer primary key, a INT, b INT);
>           ]])
> -        local STMT = sql_prepare(DB, "INSERT INTO tbl2 VALUES(1, ?, ?)", -1, "TAIL")
> +        local STMT = sql_prepare("INSERT INTO tbl2 VALUES(1, ?, ?)", -1, "TAIL")
>           sql_bind_blob(STMT, 1, "abc", 3)
>           sql_step(STMT)
>           sql_finalize(STMT)
> @@ -2439,6 +2451,7 @@ test:do_execsql_test(
>   --
>   -- MUST_WORK_TEST
>   if 0>0 then
> +local X = nil
>   test:do_execsql_test(
>       "func-25.1",
>       [[
> @@ -2470,7 +2483,7 @@ test:do_test(
>       "func-26.2",
>       function()
>           local a = ""
> -        for _ in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG","incr i"]]=]) do
> +        for i in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG","incr i"]]=]) do
>               table.insert(a,i)
>           end
>           return test:execsql(string.format([[
> @@ -2486,7 +2499,7 @@ test:do_test(
>       "func-26.3",
>       function()
>           local a = ""
> -        for _ in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG+1","incr i"]]=]) do
> +        for i in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG+1","incr i"]]=]) do
>               table.insert(a,i)
>           end
>           return test:catchsql(string.format([[
> @@ -2502,7 +2515,7 @@ test:do_test(
>       "func-26.4",
>       function()
>           local a = ""
> -        for _ in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG-1","incr i"]]=]) do
> +        for i in X(0, "X!for", [=[["set i 1","$i<=$::sql_MAX_FUNCTION_ARG-1","incr i"]]=]) do
>               table.insert(a,i)
>           end
>           return test:catchsql(string.format([[
> ====================
>
> I am sure the other files also can be properly fixed, with stubs
> and comments for legacy old functions, and with normal fixes for
> the things like in the last lines of the diff above, where it was
> a real bug - loop variable was not defined.

Your patches with small modification applied.

Diff is huge, so I won't post it here but it is in a branch and force 
pushed.

>
>> diff --git a/test/sql-tap/badutf1.test.lua b/test/sql-tap/badutf1.test.lua
>> index 654629bf7..b7fa8ce0b 100755
>> --- a/test/sql-tap/badutf1.test.lua
>> +++ b/test/sql-tap/badutf1.test.lua
>> @@ -93,8 +93,12 @@ test:do_test(
>>       })
>>   
>>   -- commented as it uses utf16
>> -if 0>0 then
>> -sql("db2", "")
>> +-- testcases are broken
>> +-- https://github.com/tarantool/tarantool/issues/5743
>> +local is_gh_5743_closed = false
>> +if is_gh_5743_closed then
>> +sql("db2", "") -- luacheck: ignore sql
>> +-- luacheck: push ignore sql_exec
> 2. Or you can use 'local sql_exec = nil', and won't need to
> write 'pop'.
For me it's not make sense. Replaced push/pop suppression with variable 
definition.
>
> The same to the other places, where you try to ignore the same
> unknown variable again and again. However I don't insist on
> hacks vs luacheck comments.
>
>>   test:do_test(
>>       "badutf-1.10",
>>       function()
>> @@ -206,7 +210,7 @@ test:do_test(
>>           -- </badutf-1.20>
>>       })
>>   end
>> -
>> +-- luacheck: pop
>>   > diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua
>> index 2f1af29b0..67f461132 100755
>> --- a/test/sql-tap/view.test.lua
>> +++ b/test/sql-tap/view.test.lua
>> @@ -1,6 +1,6 @@
>>   #!/usr/bin/env tarantool
>>   local test = require("sqltester")
>> -test:plan(78)
>> +test:plan(83)
>>   
>>   --!./tcltestrunner.lua
>>   -- 2002 February 26
>> @@ -501,21 +501,18 @@ test:do_execsql_test(
>>       })
>>   
>>   -- MUST_WORK_TEST
> 3. Why did you keep MUST_WORK_TEST, if it passes now?
> The same in other places below.

Just missed it, thanks.

--- a/test/sql-tap/view.test.lua
+++ b/test/sql-tap/view.test.lua
@@ -500,7 +500,6 @@ test:do_execsql_test(
          -- </view-7.1>
      })

--- MUST_WORK_TEST
  test:do_test(
"view-7.2",
function()
@@ -527,7 +526,6 @@ test:do_execsql_test(
          -- </view-7.3>
})

--- MUST_WORK_TEST
  test:do_test(
"view-7.4",
function()
@@ -554,7 +552,6 @@ test:do_execsql_test(
          -- </view-7.5>
})

--- MUST_WORK_TEST
  test:do_test(
      "view-7.6",
function()
@@ -578,7 +575,6 @@ test:do_execsql_test(
          -- </view-8.1>
})

--- MUST_WORK_TEST
  test:do_test(
"view-8.2",
function()
@@ -591,7 +587,6 @@ test:do_test(
          -- </view-8.2>
      })

--- MUST_WORK_TEST problem with column names
  test:do_execsql_test(
      "view-8.3",
      [[
@@ -615,7 +610,6 @@ test:do_execsql_test(
          -- </view-8.4>
      })

--- MUST_WORK_TEST
  test:do_execsql_test(
      "view-8.5",
      [[
@@ -626,7 +620,6 @@ test:do_execsql_test(
          -- </view-8.5>
      })

--- MUST_WORK_TEST
  test:do_execsql_test(
      "view-8.6",
      [[
@@ -637,7 +630,6 @@ test:do_execsql_test(
          -- </view-8.6>
      })

--- MUST_WORK_TEST
  test:do_execsql_test(
      "view-8.7",
      [[
@@ -669,7 +661,6 @@ test:do_execsql_test(
          -- </view-9.1>
      })

--- MUST_WORK_TEST order by
  test:do_execsql_test(
      "view-9.2",
      [[
@@ -680,7 +671,6 @@ test:do_execsql_test(
          -- </view-9.2>
      })

--- MUST_WORK_TEST order by
  test:do_execsql_test(
      "view-9.3",
      [[
@@ -693,7 +683,6 @@ test:do_execsql_test(
          -- </view-9.3>
      })

--- MUST_WORK_TEST order by
  test:do_execsql_test(

>
>> -if (0 > 0)
>> - then
>> -    test:do_test(
>> -        "view-7.2",
>> -        function()
>> -            return test:execsql [[
>> -                SELECT * FROM test;
>> -            ]]
>> -        end, {
>> -            -- <view-7.2>
>> -            1, 2, 3
>> -            -- </view-7.2>
>> -        })
>> +test:do_test(
>> +    "view-7.2",
>> +    function()
>> +        return test:execsql [[
>> +            SELECT * FROM test;
>> +        ]]
>> +    end, {
>> +        -- <view-7.2>
>> +        1, 2, 3
>> +        -- </view-7.2>
>> +    })
>>   
>> -end
>>   test:do_execsql_test(
>>       "view-7.3",
>>       [[
>> @@ -531,21 +528,18 @@ test:do_execsql_test(
>>       })
>>   
>>   -- MUST_WORK_TEST
>> -if (0 > 0)
>> - then
>> -    test:do_test(
>> -        "view-7.4",
>> -        function()
>> -            return test:execsql [[
>> -                SELECT * FROM test;
>> -            ]]
>> -        end, {
>> -            -- <view-7.4>
>> -            1, 2, 3
>> -            -- </view-7.4>
>> -        })
>> +test:do_test(
>> +    "view-7.4",
>> +    function()
>> +        return test:execsql [[
>> +            SELECT * FROM test;
>> +        ]]
>> +    end, {
>> +        -- <view-7.4>
>> +        1, 2, 3
>> +        -- </view-7.4>
>> +    })
>>   
>> -end
>>   test:do_execsql_test(
>>       "view-7.5",
>>       [[
>> @@ -561,21 +555,18 @@ test:do_execsql_test(
>>       })
>>   
>>   -- MUST_WORK_TEST
>> -if (0 > 0)
>> - then
>> -    test:do_test(
>> -        "view-7.6",
>> -        function()
>> -            return test:execsql [[
>> -                SELECT * FROM test;
>> -            ]]
>> -        end, {
>> -            -- <view-7.6>
>> -            1, 2, 3
>> -            -- </view-7.6>
>> -        })
>> +test:do_test(
>> +    "view-7.6",
>> +    function()
>> +        return test:execsql [[
>> +            SELECT * FROM test;
>> +        ]]
>> +    end, {
>> +        -- <view-7.6>
>> +        1, 2, 3
>> +        -- </view-7.6>
>> +    })
>>   
>> -end
>>   test:do_execsql_test(
>>       "view-8.1",
>>       [[
>> @@ -588,33 +579,29 @@ test:do_execsql_test(
>>       })
>>   
>>   -- MUST_WORK_TEST
>> -if (0 > 0)
>> - then
>> -    test:do_test(
>> -        "view-8.2",
>> -        function()
>> -            return test:execsql [[
>> -                SELECT * FROM v6 ORDER BY xyz;
>> -            ]]
>> -        end, {
>> -            -- <view-8.2>
>> -            7, 2, 13, 5, 19, 8, 27, 12
>> -            -- </view-8.2>
>> -        })
>> -
>> -    -- MUST_WORK_TEST problem with column names
>> -    test:do_execsql_test(
>> -        "view-8.3",
>> -        [[
>> -            CREATE VIEW v7(a) AS SELECT pqr+xyz FROM v6;
>> -            SELECT * FROM v7 ORDER BY a;
>> -        ]], {
>> -            -- <view-8.3>
>> -            9, 18, 27, 39
>> -            -- </view-8.3>
>> -        })
>> +test:do_test(
>> +    "view-8.2",
>> +    function()
>> +        return test:execsql [[
>> +            SELECT * FROM v6 ORDER BY xyz;
>> +        ]]
>> +    end, {
>> +        -- <view-8.2>
>> +        7, 2, 13, 5, 19, 8, 27, 12
>> +        -- </view-8.2>
>> +    })
>>   
>> -end
>> +-- MUST_WORK_TEST problem with column names
>> +test:do_execsql_test(
>> +    "view-8.3",
>> +    [[
>> +        CREATE VIEW v7(a) AS SELECT pqr+xyz FROM v6;
>> +        SELECT * FROM v7 ORDER BY a;
>> +    ]], {
>> +        -- <view-8.3>
>> +        9, 18, 27, 39
>> +        -- </view-8.3>
>> +    })
>>   
>>   test:do_execsql_test(
>>       "view-8.4",

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-01-24 17:34   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-02-16 14:09     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-02-16 14:09 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Hi,

thanks for review!

On 24.01.2021 20:34, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> See 2 comments below.
>
> On 21.01.2021 13:49, sergeyb@tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb@tarantool.org>
>>
>> W211 (Unused local variable)
>>
>> Part of #5464
>>
>> test: fix luacheck warnings W111 in test/sql-tap
>> ---
>> diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
>> index 81b08e223..f29b26175 100755
>> --- a/test/sql-tap/e_expr.test.lua
>> +++ b/test/sql-tap/e_expr.test.lua
>> @@ -1080,7 +1080,6 @@ if (0>0) then
>>       local function parameter_test(tn, sql, params, result)
>>           local stmt = sql_prepare_v2("db", sql, -1)
>>           for _ in X(0, "X!foreach", [=[["number name",["params"]]]=]) do
>> -            local nm = sql_bind_parameter_name(stmt, number)
> 1. You should not delete the function call. It seems it must have
> had an effect on the statement object. Without this call in future it
> will be harder to understand what is missing if you delete it.
reverted hunk
>
>>               X(480, "X!cmd", [=[["do_test",[["tn"],".name.",["number"]],[["list","set","",["nm"]]],["name"]]]=])
>>               sql_bind_int(stmt, number, ((-1) * number))
>>           end
>> diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
>> index 7d928bea0..b1c4f026b 100755
>> --- a/test/sql-tap/misc1.test.lua
>> +++ b/test/sql-tap/misc1.test.lua
>> @@ -726,19 +726,8 @@ test:do_execsql_test(
>>   -- MUST_WORK_TEST collate
>>   if 0>0 then
>>       db("collate", "numeric", "numeric_collate")
>> -    local function numeric_collate(lhs, rhs)
>> -        if (lhs == rhs)
>> -        then
>> -            return 0
>> -        end
>> -        return X(0, "X!expr", [=[["?:",[">",["lhs"],["rhs"]],3,["-",1]]]=])
>> -    end
> 2. The more I look at these db + X pairs, the more it seems like an
> artifact after TCL -> Lua conversion. I think originally it was
> supposed that the function after 'db()' should be called, and 'X'
> should execute something. Worth investigating how these tests looked
> originally. Otherwise we may delete too much and not able to resurrect
> the tests in future.

Yes, you are right regarding artifacts.

Although I would not like an idea to fix sql tests in scope of task with 
luacheck

and just suppress places where we cannot fix right now.

>
> If these code blocks are important for understanding the test (which I
> don't understand now, but anyway), maybe it would better to comment
> them out instead of deleing.
>
> Or delete the entire test cases if we are not going to try to resurrect
> them, which is also fine.


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
  2021-02-16 12:02     ` Sergey Bronnikov via Tarantool-patches
@ 2021-02-23 21:25       ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-25 10:39         ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-02-23 21:25 UTC (permalink / raw)
  To: Sergey Bronnikov, tarantool-patches

Hi! Thanks for the patch!

We are almost there.

See 3 comments below.

> diff --git a/test/sql-tap/badutf1.test.lua b/test/sql-tap/badutf1.test.lua
> index 654629bf7..f375fea0f 100755
> --- a/test/sql-tap/badutf1.test.lua
> +++ b/test/sql-tap/badutf1.test.lua
> @@ -93,8 +93,12 @@ test:do_test(
>      })
>  
>  -- commented as it uses utf16
> -if 0>0 then
> -sql("db2", "")
> +-- testcases are broken
> +-- https://github.com/tarantool/tarantool/issues/5743
> +local is_gh_5743_closed = false
> +if is_gh_5743_closed then
> +sql("db2", "") -- luacheck: ignore sql
> +local sql_exec = nil

>> For me it's not make sense. Replaced push/pop suppression with variable definition.

1. Lets at least be consistent and either use `-- luacheck` comments or
`= nil` hack. Not both, especially not on 2 adjacent lines. It simply
raises unnecessary questions why couldn't it be done in one way.

>  test:do_test(
>      "badutf-1.10",
>      function()> diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua
> index 2a189582d..9ef5e7925 100755
> --- a/test/sql-tap/e_select1.test.lua
> +++ b/test/sql-tap/e_select1.test.lua
> @@ -1537,32 +1561,26 @@ test:do_select_tests(
>  -- considered equal to other NULL values and distinct from all non-NULL
>  -- values.
>  --
> --- MUST_WORK_TEST
> -if 0>0 then
> -db("nullvalue", "null")
>  test:do_select_tests(
>      "e_select-7.9",
>      {
> -        {"1", "SELECT NULL UNION ALL SELECT NULL", {null, null}},
> -        {"2", "SELECT NULL UNION     SELECT NULL", {null}},
> -        {"3", "SELECT NULL INTERSECT SELECT NULL", {null}},
> +        {"1", "SELECT NULL UNION ALL SELECT NULL", {"", ""}},
> +        {"2", "SELECT NULL UNION     SELECT NULL", {""}},
> +        {"3", "SELECT NULL INTERSECT SELECT NULL", {""}},
>          {"4", "SELECT NULL EXCEPT    SELECT NULL", {}},

2. But why? What was the effect of `db("nullvalue", "null")` in the
original tests? If you don't know then maybe it is worth leaving it
as is + adding `local null = box.NULL` or `local null = nil` so at
least we could preserve the test body unchanged for future
investigations.

To me it is not clear why null can be "". Empty string is not the
same as NULL.

The same for the other `db("nullvalue", "null")` removals where
`null` was used for anything. If there are such other places.

> -        {"5", "SELECT NULL UNION ALL SELECT 'ab'", {null, "ab"}},
> -        {"6", "SELECT NULL UNION     SELECT 'ab'", {null, "ab"}},
> +        {"5", "SELECT NULL UNION ALL SELECT 'ab'", {"", "ab"}},
> +        {"6", "SELECT NULL UNION     SELECT 'ab'", {"", "ab"}},
>          {"7", "SELECT NULL INTERSECT SELECT 'ab'", {}},
> -        {"8", "SELECT NULL EXCEPT    SELECT 'ab'", {null}},
> -        {"9", "SELECT NULL UNION ALL SELECT 0", {null, 0}},
> -        {"10", "SELECT NULL UNION     SELECT 0", {null, 0}},
> +        {"8", "SELECT NULL EXCEPT    SELECT 'ab'", {""}},
> +        {"9", "SELECT NULL UNION ALL SELECT 0", {"", 0}},
> +        {"10", "SELECT NULL UNION     SELECT 0", {"", 0}},
>          {"11", "SELECT NULL INTERSECT SELECT 0", {}},
> -        {"12", "SELECT NULL EXCEPT    SELECT 0", {null}},
> -        {"13", "SELECT c FROM q1 UNION ALL SELECT g FROM q3", {null, -42.47, "null", 2, 2}},
> -        {"14", "SELECT c FROM q1 UNION     SELECT g FROM q3", {null, -42.47, 2}},
> +        {"12", "SELECT NULL EXCEPT    SELECT 0", {""}},
> +        {"13", "SELECT c FROM q1 UNION ALL SELECT g FROM q3", {"", -42.47, "", 2, 2}},
> +        {"14", "SELECT c FROM q1 UNION     SELECT g FROM q3", {"", -42.47, 2}},
>          {"15", "SELECT c FROM q1 INTERSECT SELECT g FROM q3", {}},
> -        {"16", "SELECT c FROM q1 EXCEPT    SELECT g FROM q3", {null, -42.47}},
> +        {"16", "SELECT c FROM q1 EXCEPT    SELECT g FROM q3", {"", -42.47}},
>      })
> -
> -db("nullvalue", "")
> -end
> diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
> index ea25727a4..574faafd6 100755
> --- a/test/sql-tap/index1.test.lua
> +++ b/test/sql-tap/index1.test.lua
> @@ -585,7 +585,7 @@ test:do_test(
>          for i = 1, 50, 1 do
>              test:execsql(string.format("INSERT INTO t3 VALUES('x%sx',%s,0.%s)", i, i, i))
>          end
> -        local sql_search_count = 0
> +        -- luacheck: ignore X

3. Lets be consistent and not jump from one method to another.
We either use luacheck comments or `local X = nil` hacks. The same
for other similar inconsistencies in this and the rest of the patches.

>          return X(381, "X!cmd", [=[["concat",[["execsql","SELECT c FROM t3 WHERE b==10"]],["sql_search_count"]]]=])
>      end, {
>          -- <index-11.1>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 " Sergey Bronnikov via Tarantool-patches
  2021-01-24 17:34   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-02-23 21:26   ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-25 11:02     ` Sergey Bronnikov via Tarantool-patches
  1 sibling, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-02-23 21:26 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Thanks for the patch!

See 5 comments below.

> diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
> index 37a7b7177..046ed8711 100755
> --- a/test/sql-tap/e_expr.test.lua
> +++ b/test/sql-tap/e_expr.test.lua
> @@ -1087,7 +1087,7 @@ if (0>0) then
>          local number = nil
>          local stmt = sql_prepare_v2(sql, -1)
>          for _ in X(0, "X!foreach", [=[["number name",["params"]]]=]) do
> -            local nm = sql_bind_parameter_name(stmt, number)
> +            local nm = sql_bind_parameter_name(stmt, number) -- luacheck: no unused

1. Why do you need 'nm' if it is unused? You don't need to drop the
entire line. Just delete 'nm' variable and leave the function call
without saving its result to anything. The same below for 'rc' and
'sql_finalize()'.

>              X(480, "X!cmd", [=[["do_test",[["tn"],".name.",["number"]],[["list","set","",["nm"]]],["name"]]]=])
>              sql_bind_int(stmt, number, ((-1) * number))
>          end
> diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
> index 9cd517673..5dab23007 100755
> --- a/test/sql-tap/func.test.lua
> +++ b/test/sql-tap/func.test.lua
> @@ -1382,7 +1380,6 @@ test:do_execsql_test(
>      })
>  
>  db("cache", "flush")
> -V = "three"

2. 'V' is supposed to be a variable. It is used in the queries
in the surrounding code. Please, don't delete parts of the tests.
It will not make it simpler to restore the context later. The tests
in this patchset either must be deleted, or resurrected, or hacked
to keep their context and not fail luacheck. What to choose - depends
on individual tests. Here clearly we need to keep 'V'. Try to make
another pass of self-review to locate more of such test-"breaking"
changes.

> diff --git a/test/sql-tap/selectA.test.lua b/test/sql-tap/selectA.test.lua
> index a608ab093..db4d03985 100755
> --- a/test/sql-tap/selectA.test.lua
> +++ b/test/sql-tap/selectA.test.lua
> @@ -2359,9 +2357,6 @@ test:do_execsql_test(
>  if (0 > 0)
>   then
>  end
> -local function f(args)
> -    return 1
> -end

3. It seems the function is supposed to be somehow used a few
lines below. Please, keep it.

>  -- TODO stored procedures are not supported by now
>  --db("func", "f", "f")> diff --git a/test/sql-tap/sort.test.lua b/test/sql-tap/sort.test.lua
> index 1cf0d14a8..0de598969 100755
> --- a/test/sql-tap/sort.test.lua
> +++ b/test/sql-tap/sort.test.lua
> @@ -802,7 +801,6 @@ box.internal.sql_create_function("cksum", cksum)
>              "sort-14."..tn,
>              function()
>                  sql_test_control("sql_TESTCTRL_SORTER_MMAP", "db", mmap_limit)
> -                local prev = ""

4. Prev is supposed to be used in the request on the next line. It
has `$prev` expression inside.

>                  X(536, "X!cmd", [=[["db","eval"," SELECT * FROM t11 ORDER BY b ","\n         if {$b != [cksum $a]} {error \"checksum failed\"}\n         if {[string compare $b $prev] < 0} {error \"sort failed\"}\n         set prev $b\n       "]]=])
>                  return X(541, "X!cmd", [=[["set","",""]]=])
>              end, {
> diff --git a/test/sql-tap/trigger1.test.lua b/test/sql-tap/trigger1.test.lua
> index 8224ef1ec..0efdd21bc 100755
> --- a/test/sql-tap/trigger1.test.lua
> +++ b/test/sql-tap/trigger1.test.lua
> @@ -482,8 +482,6 @@ test:execsql [[
>  -- trigger works.  Then drop the trigger.  Make sure the table is
>  -- still there.
>  --
> -local view_v1 = "view v1"

5. The variable is "used" in some of the commented out tests below.

> -
>  
>  -- do_test trigger1-6.1 {
>  --   execsql {SELECT type, name FROM sql_master}

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
  2021-02-23 21:25       ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-02-25 10:39         ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-02-25 10:39 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 5488 bytes --]

Hello,

thanks for review again

On 24.02.2021 00:25, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch!
>
> We are almost there.
>
> See 3 comments below.
>
>> diff --git a/test/sql-tap/badutf1.test.lua b/test/sql-tap/badutf1.test.lua
>> index 654629bf7..f375fea0f 100755
>> --- a/test/sql-tap/badutf1.test.lua
>> +++ b/test/sql-tap/badutf1.test.lua
>> @@ -93,8 +93,12 @@ test:do_test(
>>       })
>>   
>>   -- commented as it uses utf16
>> -if 0>0 then
>> -sql("db2", "")
>> +-- testcases are broken
>> +-- https://github.com/tarantool/tarantool/issues/5743
>> +local is_gh_5743_closed = false
>> +if is_gh_5743_closed then
>> +sql("db2", "") -- luacheck: ignore sql
>> +local sql_exec = nil
>>> For me it's not make sense. Replaced push/pop suppression with variable definition.
> 1. Lets at least be consistent and either use `-- luacheck` comments or
> `= nil` hack. Not both, especially not on 2 adjacent lines. It simply
> raises unnecessary questions why couldn't it be done in one way.

Setted undefined variables/functions to nil everywhere instead of inline 
luacheck supressions.

There some places in files lua_sql.test.lua, subquery.test.lua and 
minmax2.test.lua where I still use luacheck suppressions

because setting variables/functions to nil doesn't work and broke tests.

>
>>   test:do_test(
>>       "badutf-1.10",
>>       function()> diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua
>> index 2a189582d..9ef5e7925 100755
>> --- a/test/sql-tap/e_select1.test.lua
>> +++ b/test/sql-tap/e_select1.test.lua
>> @@ -1537,32 +1561,26 @@ test:do_select_tests(
>>   -- considered equal to other NULL values and distinct from all non-NULL
>>   -- values.
>>   --
>> --- MUST_WORK_TEST
>> -if 0>0 then
>> -db("nullvalue", "null")
>>   test:do_select_tests(
>>       "e_select-7.9",
>>       {
>> -        {"1", "SELECT NULL UNION ALL SELECT NULL", {null, null}},
>> -        {"2", "SELECT NULL UNION     SELECT NULL", {null}},
>> -        {"3", "SELECT NULL INTERSECT SELECT NULL", {null}},
>> +        {"1", "SELECT NULL UNION ALL SELECT NULL", {"", ""}},
>> +        {"2", "SELECT NULL UNION     SELECT NULL", {""}},
>> +        {"3", "SELECT NULL INTERSECT SELECT NULL", {""}},
>>           {"4", "SELECT NULL EXCEPT    SELECT NULL", {}},
> 2. But why? What was the effect of `db("nullvalue", "null")` in the
> original tests? If you don't know then maybe it is worth leaving it
> as is + adding `local null = box.NULL` or `local null = nil` so at
> least we could preserve the test body unchanged for future
> investigations.

Well, reverted hunks back and disabled testcase in the test.

I found a source code of original test [1] and it is not clear

why "nullvalue" redefined there.

1. 
https://www.sqlite.org/src/file?ci=trunk&name=test%2Fe_select.test&ln=1504

> To me it is not clear why null can be "". Empty string is not the
> same as NULL.
>
> The same for the other `db("nullvalue", "null")` removals where
> `null` was used for anything. If there are such other places.
Done
>> -        {"5", "SELECT NULL UNION ALL SELECT 'ab'", {null, "ab"}},
>> -        {"6", "SELECT NULL UNION     SELECT 'ab'", {null, "ab"}},
>> +        {"5", "SELECT NULL UNION ALL SELECT 'ab'", {"", "ab"}},
>> +        {"6", "SELECT NULL UNION     SELECT 'ab'", {"", "ab"}},
>>           {"7", "SELECT NULL INTERSECT SELECT 'ab'", {}},
>> -        {"8", "SELECT NULL EXCEPT    SELECT 'ab'", {null}},
>> -        {"9", "SELECT NULL UNION ALL SELECT 0", {null, 0}},
>> -        {"10", "SELECT NULL UNION     SELECT 0", {null, 0}},
>> +        {"8", "SELECT NULL EXCEPT    SELECT 'ab'", {""}},
>> +        {"9", "SELECT NULL UNION ALL SELECT 0", {"", 0}},
>> +        {"10", "SELECT NULL UNION     SELECT 0", {"", 0}},
>>           {"11", "SELECT NULL INTERSECT SELECT 0", {}},
>> -        {"12", "SELECT NULL EXCEPT    SELECT 0", {null}},
>> -        {"13", "SELECT c FROM q1 UNION ALL SELECT g FROM q3", {null, -42.47, "null", 2, 2}},
>> -        {"14", "SELECT c FROM q1 UNION     SELECT g FROM q3", {null, -42.47, 2}},
>> +        {"12", "SELECT NULL EXCEPT    SELECT 0", {""}},
>> +        {"13", "SELECT c FROM q1 UNION ALL SELECT g FROM q3", {"", -42.47, "", 2, 2}},
>> +        {"14", "SELECT c FROM q1 UNION     SELECT g FROM q3", {"", -42.47, 2}},
>>           {"15", "SELECT c FROM q1 INTERSECT SELECT g FROM q3", {}},
>> -        {"16", "SELECT c FROM q1 EXCEPT    SELECT g FROM q3", {null, -42.47}},
>> +        {"16", "SELECT c FROM q1 EXCEPT    SELECT g FROM q3", {"", -42.47}},
>>       })
>> -
>> -db("nullvalue", "")
>> -end
>> diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
>> index ea25727a4..574faafd6 100755
>> --- a/test/sql-tap/index1.test.lua
>> +++ b/test/sql-tap/index1.test.lua
>> @@ -585,7 +585,7 @@ test:do_test(
>>           for i = 1, 50, 1 do
>>               test:execsql(string.format("INSERT INTO t3 VALUES('x%sx',%s,0.%s)", i, i, i))
>>           end
>> -        local sql_search_count = 0
>> +        -- luacheck: ignore X
> 3. Lets be consistent and not jump from one method to another.
> We either use luacheck comments or `local X = nil` hacks. The same
> for other similar inconsistencies in this and the rest of the patches.
Done (except files lua_sql.test.lua, subquery.test.lua and 
minmax2.test.lua, see above)
>
>>           return X(381, "X!cmd", [=[["concat",[["execsql","SELECT c FROM t3 WHERE b==10"]],["sql_search_count"]]]=])
>>       end, {
>>           -- <index-11.1>

[-- Attachment #2: Type: text/html, Size: 7884 bytes --]

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-02-23 21:26   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-02-25 11:02     ` Sergey Bronnikov via Tarantool-patches
  2021-02-26 23:42       ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-02-25 11:02 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Hello,

On 24.02.2021 00:26, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> See 5 comments below.
>
>> diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
>> index 37a7b7177..046ed8711 100755
>> --- a/test/sql-tap/e_expr.test.lua
>> +++ b/test/sql-tap/e_expr.test.lua
>> @@ -1087,7 +1087,7 @@ if (0>0) then
>>           local number = nil
>>           local stmt = sql_prepare_v2(sql, -1)
>>           for _ in X(0, "X!foreach", [=[["number name",["params"]]]=]) do
>> -            local nm = sql_bind_parameter_name(stmt, number)
>> +            local nm = sql_bind_parameter_name(stmt, number) -- luacheck: no unused
> 1. Why do you need 'nm' if it is unused? You don't need to drop the
> entire line. Just delete 'nm' variable and leave the function call
> without saving its result to anything. The same below for 'rc' and
> 'sql_finalize()'.

reverted changes back

--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -1087,7 +1087,7 @@ if (0>0) then
          local number = nil
          local stmt = sql_prepare_v2(sql, -1)
          for _ in X(0, "X!foreach", [=[["number name",["params"]]]=]) do
-            local nm = sql_bind_parameter_name(stmt, number) -- 
luacheck: no unused
+            sql_bind_parameter_name(stmt, number)
              X(480, "X!cmd", 
[=[["do_test",[["tn"],".name.",["number"]],[["list","set","",["nm"]]],["name"]]]=])
              sql_bind_int(stmt, number, ((-1) * number))
          end
@@ -1103,7 +1103,7 @@ if (0>0) then
          -- Legacy from the original code. Must be replaced with analogue
          -- functions from box.
          local sql_finalize = nil
-        local rc = sql_finalize(stmt) -- luacheck: no unused
+        sql_finalize(stmt)
          X(491, "X!cmd", 
[=[["do_test",[["tn"],".rc"],[["list","set","",["rc"]]],"sql_OK"]]=])
          X(492, "X!cmd", 
[=[["do_test",[["tn"],".res"],[["list","set","",["res"]]],["result"]]]=])
      end

>
>>               X(480, "X!cmd", [=[["do_test",[["tn"],".name.",["number"]],[["list","set","",["nm"]]],["name"]]]=])
>>               sql_bind_int(stmt, number, ((-1) * number))
>>           end
>> diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
>> index 9cd517673..5dab23007 100755
>> --- a/test/sql-tap/func.test.lua
>> +++ b/test/sql-tap/func.test.lua
>> @@ -1382,7 +1380,6 @@ test:do_execsql_test(
>>       })
>>   
>>   db("cache", "flush")
>> -V = "three"
> 2. 'V' is supposed to be a variable. It is used in the queries
> in the surrounding code. Please, don't delete parts of the tests.
> It will not make it simpler to restore the context later. The tests
> in this patchset either must be deleted, or resurrected, or hacked
> to keep their context and not fail luacheck. What to choose - depends
> on individual tests. Here clearly we need to keep 'V'. Try to make
> another pass of self-review to locate more of such test-"breaking"
> changes.

reverted and suppressed

--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -1382,6 +1382,7 @@ test:do_execsql_test(
      })

  db("cache", "flush")
+local V = "three" -- luacheck: no unused
  test:do_execsql_test(
      "13.8.6",
      [[

>> diff --git a/test/sql-tap/selectA.test.lua b/test/sql-tap/selectA.test.lua
>> index a608ab093..db4d03985 100755
>> --- a/test/sql-tap/selectA.test.lua
>> +++ b/test/sql-tap/selectA.test.lua
>> @@ -2359,9 +2357,6 @@ test:do_execsql_test(
>>   if (0 > 0)
>>    then
>>   end
>> -local function f(args)
>> -    return 1
>> -end
> 3. It seems the function is supposed to be somehow used a few
> lines below. Please, keep it.
>
reverted and suppressed

--- a/test/sql-tap/selectA.test.lua
+++ b/test/sql-tap/selectA.test.lua
@@ -2357,6 +2357,9 @@ test:do_execsql_test(
  if (0 > 0)
   then
  end
+local function f(args) -- luacheck: no unused
+    return 1
+end

  -- TODO stored procedures are not supported by now
  --db("func", "f", "f")

>>   -- TODO stored procedures are not supported by now
>>   --db("func", "f", "f")> diff --git a/test/sql-tap/sort.test.lua b/test/sql-tap/sort.test.lua
>> index 1cf0d14a8..0de598969 100755
>> --- a/test/sql-tap/sort.test.lua
>> +++ b/test/sql-tap/sort.test.lua
>> @@ -802,7 +801,6 @@ box.internal.sql_create_function("cksum", cksum)
>>               "sort-14."..tn,
>>               function()
>>                   sql_test_control("sql_TESTCTRL_SORTER_MMAP", "db", mmap_limit)
>> -                local prev = ""
> 4. Prev is supposed to be used in the request on the next line. It
> has `$prev` expression inside.

reverted and suppressed

--- a/test/sql-tap/sort.test.lua
+++ b/test/sql-tap/sort.test.lua
@@ -801,6 +801,7 @@ box.internal.sql_create_function("cksum", cksum)
              "sort-14."..tn,
              function()
                  sql_test_control("sql_TESTCTRL_SORTER_MMAP", "db", 
mmap_limit)
+                local prev = "" -- luacheck: no unused
                  X(536, "X!cmd", [=[["db","eval"," SELECT * FROM t11 
ORDER BY b ","\n         if {$b != [cksum $a]} {error \"checksum 
failed\"}\n         if {[string compare $b $prev] < 0} {error \"sort 
failed\"}\n         set prev $b\n       "]]=])
                  return X(541, "X!cmd", [=[["set","",""]]=])
              end, {

>
>>                   X(536, "X!cmd", [=[["db","eval"," SELECT * FROM t11 ORDER BY b ","\n         if {$b != [cksum $a]} {error \"checksum failed\"}\n         if {[string compare $b $prev] < 0} {error \"sort failed\"}\n         set prev $b\n       "]]=])
>>                   return X(541, "X!cmd", [=[["set","",""]]=])
>>               end, {
>> diff --git a/test/sql-tap/trigger1.test.lua b/test/sql-tap/trigger1.test.lua
>> index 8224ef1ec..0efdd21bc 100755
>> --- a/test/sql-tap/trigger1.test.lua
>> +++ b/test/sql-tap/trigger1.test.lua
>> @@ -482,8 +482,6 @@ test:execsql [[
>>   -- trigger works.  Then drop the trigger.  Make sure the table is
>>   -- still there.
>>   --
>> -local view_v1 = "view v1"
> 5. The variable is "used" in some of the commented out tests below.

reverted and suppressed

--- a/test/sql-tap/trigger1.test.lua
+++ b/test/sql-tap/trigger1.test.lua
@@ -483,6 +483,7 @@ test:execsql [[
  -- still there.
  --

+local view_v1 = "view v1" -- luacheck: no unused
  -- do_test trigger1-6.1 {
  --   execsql {SELECT type, name FROM sql_master}
  -- } [concat $view_v1 {table t2}]

>
>> -
>>   
>>   -- do_test trigger1-6.1 {
>>   --   execsql {SELECT type, name FROM sql_master}

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
  2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap Sergey Bronnikov via Tarantool-patches
  2021-01-24 17:33   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-02-26 23:42   ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-27 17:53     ` Sergey Bronnikov via Tarantool-patches
  1 sibling, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-02-26 23:42 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Hi again! Thanks for the fixes!

>>> -if 0>0 then
>>> -db("nullvalue", "null")
>>>  test:do_select_tests(
>>>      "e_select-7.9",
>>>      {
>>> -        {"1", "SELECT NULL UNION ALL SELECT NULL", {null, null}},
>>> -        {"2", "SELECT NULL UNION     SELECT NULL", {null}},
>>> -        {"3", "SELECT NULL INTERSECT SELECT NULL", {null}},
>>> +        {"1", "SELECT NULL UNION ALL SELECT NULL", {"", ""}},
>>> +        {"2", "SELECT NULL UNION     SELECT NULL", {""}},
>>> +        {"3", "SELECT NULL INTERSECT SELECT NULL", {""}},
>>>          {"4", "SELECT NULL EXCEPT    SELECT NULL", {}},
>> 2. But why? What was the effect of `db("nullvalue", "null")` in the
>> original tests? If you don't know then maybe it is worth leaving it
>> as is + adding `local null = box.NULL` or `local null = nil` so at
>> least we could preserve the test body unchanged for future
>> investigations.
> 
> Well, reverted hunks back and disabled testcase in the test.
> 
> I found a source code of original test [1] and it is not clear
> 
> why "nullvalue" redefined there.
> 
> 1. https://www.sqlite.org/src/file?ci=trunk&name=test%2Fe_select.test&ln=1504

It is not 'redefinition' it seems.
https://www.oreilly.com/library/view/using-sqlite/9781449394592/re64.html

It is a marker for output. From what I understood, sqlite prints NULLs as
empty string, and here in the test they wanted to look for NULLs in the
result. But you can't look for N empty strings. So NULL's string representation
was replaced with "null" temporary. In our case it won't happen because we
know number of returned columns and their exact values. Somebody will find
the same in the future and will either fix or delete the test.

See 4 more comments below and diff in the end of the email.

> diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
> index b22f195ca..4704970c8 100755
> --- a/test/sql-tap/lua_sql.test.lua
> +++ b/test/sql-tap/lua_sql.test.lua
> @@ -75,9 +75,10 @@ box.schema.func.create('CHECK_FROM_SQL_TO_LUA', {language = 'Lua',
>                         exports = {'LUA', 'SQL'}})
>  
>  -- check for different types
> -for i = 1, #from_sql_to_lua, 1 do
> +for i = 1, #from_sql_to_lua, 1 do -- luacheck: ignore from_sql_to_lua
>      test:do_execsql_test(
>          "lua_sql-2.2."..i,
> +        -- luacheck: ignore from_sql_to_lua

1. You can just declare local from_sql_to_lua and also save it to _G. No
need to ignore it.

>          "select check_from_sql_to_lua("..i..","..from_sql_to_lua[i][1]..")",
>          {1})
>  end
> @@ -102,9 +103,10 @@ box.schema.func.create('CHECK_FROM_LUA_TO_SQL', {language = 'Lua',
>                         exports = {'LUA', 'SQL'}})
>  
>  -- check for different types
> -for i = 1, #from_lua_to_sql, 1 do
> +for i = 1, #from_lua_to_sql, 1 do -- luacheck: ignore from_lua_to_sql
>      test:do_execsql_test(
>          "lua_sql-2.3."..i,
> +        -- luacheck: ignore from_lua_to_sql
>          "select "..tostring(from_lua_to_sql[i][1]).." = check_from_lua_to_sql("..i..")",
>          {true})
>  end
> diff --git a/test/sql-tap/minmax2.test.lua b/test/sql-tap/minmax2.test.lua
> index f3d608aab..b6c02a4cc 100755
> --- a/test/sql-tap/minmax2.test.lua
> +++ b/test/sql-tap/minmax2.test.lua
> @@ -72,6 +72,7 @@ test:do_test(
>  test:do_test(
>      "minmax2-1.2",
>      function()
> +        -- luacheck: ignore sql_search_count
>          return box.stat.sql().sql_search_count - sql_search_count

2. There is no reason for sql_search_count to be global.

>      end, 19)
>  
> @@ -89,6 +90,7 @@ test:do_test(
>  test:do_test(
>      "minmax2-1.4",
>      function()
> +        -- luacheck: ignore sql_search_count
>          return box.stat.sql().sql_search_count - sql_search_count
>      end, 19)
>  
> diff --git a/test/sql-tap/subquery.test.lua b/test/sql-tap/subquery.test.lua
> index f57a22624..bb03f25ab 100755
> --- a/test/sql-tap/subquery.test.lua
> +++ b/test/sql-tap/subquery.test.lua
> @@ -684,6 +684,8 @@ test:do_test(
>          -- This is the key test.  The subquery should have only run once.  If
>          -- The double-quoted identifier "two" were causing the subquery to be
>          -- processed as a correlated subquery, then it would have run 4 times.
> +
> +        -- luacheck: ignore callcnt
>          return callcnt

3. This can be fixed, lets not ignore it. One way would be
to store callcnt in a table which is saved in a local variable
and into _G.

	local callcnt = {value = 0}
	_G.callcnt = callcnt

Then you can use callcnt.value from anywhere to reference the
same counter.

Another way is to have it local and update it via a function
stored in _G.

Also can simply write _G.callcnt in 3 more places instead of
ignoring it.

>      end, 1)
>  
> @@ -706,7 +708,9 @@ test:do_test(
>  test:do_test(
>      "subquery-6.2",
>      function()
> +        -- luacheck: ignore callcnt
>          return callcnt
> +
>      end, 4)
>  
>  test:do_test(
> @@ -725,6 +729,7 @@ test:do_test(
>  test:do_test(
>      "subquery-6.4",
>      function()
> +        -- luacheck: ignore callcnt
>          return callcnt
>      end, 1)
>  
> diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua
> index e95641938..7d496bc4d 100755
> --- a/test/sql-tap/triggerC.test.lua
> +++ b/test/sql-tap/triggerC.test.lua
> @@ -791,7 +791,6 @@ for testno, v in ipairs(tests11) do
>                  SELECT a,b FROM log;
>              ]]
>          end, {
> -            defaults

4. The variable is supposed to be filled with something, from
what I see in the commented code.

You can declare it with nil somewhere above to keep the not
working tests intact.

>          })
>  
>      --
> diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua
> index 2f1af29b0..40fc71998 100755
> --- a/test/sql-tap/view.test.lua
> +++ b/test/sql-tap/view.test.lua
> @@ -1119,6 +1093,9 @@ if (0 > 0)
>              -- </view-22.1>
>          })
>  
> +    -- Legacy from the original code. Must be replaced with analogue
> +    -- functions from box.
> +    local X = nil
>      test:do_test(
>          "view-22.2",
>          function()

I tried to fix some of my comments:

====================
diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
index 4704970c8..d073ffe4f 100755
--- a/test/sql-tap/lua_sql.test.lua
+++ b/test/sql-tap/lua_sql.test.lua
@@ -51,7 +51,7 @@ for _, val in ipairs({
         {result})
 end
 
-_G.from_sql_to_lua = {
+local from_sql_to_lua = {
     [1] = {1, 1},
     [2] = {"1", 1},
     [3] = {"1.5", 1.5},
@@ -60,6 +60,7 @@ _G.from_sql_to_lua = {
     [6] = {"x'0500'", "\u{0005}\u{0000}"},
     [7] = {"123123123123123", 123123123123123LL},
 }
+_G.from_sql_to_lua = from_sql_to_lua
 
 box.schema.func.create('CHECK_FROM_SQL_TO_LUA', {language = 'Lua',
                        is_deterministic = true,
@@ -75,10 +76,9 @@ box.schema.func.create('CHECK_FROM_SQL_TO_LUA', {language = 'Lua',
                        exports = {'LUA', 'SQL'}})
 
 -- check for different types
-for i = 1, #from_sql_to_lua, 1 do -- luacheck: ignore from_sql_to_lua
+for i = 1, #from_sql_to_lua, 1 do
     test:do_execsql_test(
         "lua_sql-2.2."..i,
-        -- luacheck: ignore from_sql_to_lua
         "select check_from_sql_to_lua("..i..","..from_sql_to_lua[i][1]..")",
         {1})
 end
diff --git a/test/sql-tap/minmax2.test.lua b/test/sql-tap/minmax2.test.lua
index b6c02a4cc..6a7859d42 100755
--- a/test/sql-tap/minmax2.test.lua
+++ b/test/sql-tap/minmax2.test.lua
@@ -56,12 +56,12 @@ test:do_execsql_test(
         -- </minmax2-1.0>
     })
 
-_G.sql_search_count = 0
+local sql_search_count = 0
 
 test:do_test(
     "minmax2-1.1",
     function()
-        _G.sql_search_count = box.stat.sql().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT min(x) FROM t1"
     end, {
         -- <minmax2-1.1>
@@ -72,14 +72,13 @@ test:do_test(
 test:do_test(
     "minmax2-1.2",
     function()
-        -- luacheck: ignore sql_search_count
         return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
 test:do_test(
     "minmax2-1.3",
     function()
-        _G.sql_search_count = box.stat.sql().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(x) FROM t1"
     end, {
         -- <minmax2-1.3>
@@ -90,7 +89,6 @@ test:do_test(
 test:do_test(
     "minmax2-1.4",
     function()
-        -- luacheck: ignore sql_search_count
         return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
@@ -98,7 +96,7 @@ test:do_test(
     "minmax2-1.5",
     function()
         test:execsql "CREATE INDEX t1i1 ON t1(x DESC)"
-        _G.sql_search_count = box.stat.sql().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT min(x) FROM t1"
     end, {
         -- <minmax2-1.5>
@@ -109,13 +107,13 @@ test:do_test(
 test:do_test(
     "minmax2-1.6",
     function()
-        return box.stat.sql().sql_search_count - _G.sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 1)
 
 test:do_test(
     "minmax2-1.7",
     function()
-        _G.sql_search_count = box.stat.sql().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(x) FROM t1"
     end, {
         -- <minmax2-1.7>
@@ -126,13 +124,13 @@ test:do_test(
 test:do_test(
     "minmax2-1.8",
     function()
-        return box.stat.sql().sql_search_count - _G.sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
     "minmax2-1.9",
     function()
-        _G.sql_search_count = box.stat.sql().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(y) FROM t1"
     end, {
         -- <minmax2-1.9>
@@ -143,7 +141,7 @@ test:do_test(
 test:do_test(
     "minmax2-1.10",
     function()
-        return box.stat.sql().sql_search_count - _G.sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
 test:do_test(
@@ -153,7 +151,7 @@ test:do_test(
             CREATE TABLE t2(a INTEGER PRIMARY KEY, b INT );
             INSERT INTO t2 SELECT x, y FROM t1;
         ]]
-        _G.sql_search_count = box.stat.sql().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT min(a) FROM t2"
     end, {
         -- <minmax2-2.0>
@@ -164,13 +162,13 @@ test:do_test(
 test:do_test(
     "minmax2-2.1",
     function()
-        return box.stat.sql().sql_search_count - _G.sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
     "minmax2-2.2",
     function()
-        _G.sql_search_count = box.stat.sql().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(a) FROM t2"
     end, {
         -- <minmax2-2.2>
@@ -181,7 +179,7 @@ test:do_test(
 test:do_test(
     "minmax2-2.3",
     function()
-        return box.stat.sql().sql_search_count - _G.sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
@@ -190,7 +188,7 @@ test:do_test(
         test:execsql "INSERT INTO t2 VALUES((SELECT max(a) FROM t2)+1,999)"
 
 
-        _G.sql_search_count = box.stat.sql().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(a) FROM t2"
     end, {
         -- <minmax2-3.0>
@@ -201,7 +199,7 @@ test:do_test(
 test:do_test(
     "minmax2-3.1",
     function()
-        return box.stat.sql().sql_search_count - _G.sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
@@ -210,7 +208,7 @@ test:do_test(
         test:execsql "INSERT INTO t2 VALUES((SELECT max(a) FROM t2)+1,999)"
 
 
-        _G.sql_search_count = box.stat.sql().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql " SELECT b FROM t2 WHERE a=(SELECT max(a) FROM t2) "
 
 
@@ -224,7 +222,7 @@ test:do_test(
 test:do_test(
     "minmax2-3.3",
     function()
-        return box.stat.sql().sql_search_count - _G.sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 1)
 
 test:do_execsql_test(
diff --git a/test/sql-tap/subquery.test.lua b/test/sql-tap/subquery.test.lua
index bb03f25ab..df3075ee3 100755
--- a/test/sql-tap/subquery.test.lua
+++ b/test/sql-tap/subquery.test.lua
@@ -685,8 +685,7 @@ test:do_test(
         -- The double-quoted identifier "two" were causing the subquery to be
         -- processed as a correlated subquery, then it would have run 4 times.
 
-        -- luacheck: ignore callcnt
-        return callcnt
+        return _G.callcnt
     end, 1)
 
 -- Ticket #1380.  Make sure correlated subqueries on an IN clause work
@@ -708,8 +707,7 @@ test:do_test(
 test:do_test(
     "subquery-6.2",
     function()
-        -- luacheck: ignore callcnt
-        return callcnt
+        return _G.callcnt
 
     end, 4)
 
@@ -729,8 +727,7 @@ test:do_test(
 test:do_test(
     "subquery-6.4",
     function()
-        -- luacheck: ignore callcnt
-        return callcnt
+        return _G.callcnt
     end, 1)
 
 box.func.CALLCNT:drop()


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-02-25 11:02     ` Sergey Bronnikov via Tarantool-patches
@ 2021-02-26 23:42       ` Vladislav Shpilevoy via Tarantool-patches
  2021-02-27 17:09         ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-02-26 23:42 UTC (permalink / raw)
  To: Sergey Bronnikov, tarantool-patches

Thanks for the fixes!

>>> diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
>>> index 9cd517673..5dab23007 100755
>>> --- a/test/sql-tap/func.test.lua
>>> +++ b/test/sql-tap/func.test.lua
>>> @@ -1382,7 +1380,6 @@ test:do_execsql_test(
>>>       })
>>>     db("cache", "flush")
>>> -V = "three"
>> 2. 'V' is supposed to be a variable. It is used in the queries
>> in the surrounding code. Please, don't delete parts of the tests.
>> It will not make it simpler to restore the context later. The tests
>> in this patchset either must be deleted, or resurrected, or hacked
>> to keep their context and not fail luacheck. What to choose - depends
>> on individual tests. Here clearly we need to keep 'V'. Try to make
>> another pass of self-review to locate more of such test-"breaking"
>> changes.
> 
> reverted and suppressed
> 
> --- a/test/sql-tap/func.test.lua
> +++ b/test/sql-tap/func.test.lua
> @@ -1382,6 +1382,7 @@ test:do_execsql_test(
>      })
> 
>  db("cache", "flush")
> +local V = "three" -- luacheck: no unused
>  test:do_execsql_test(
>      "13.8.6",
>      [[

Now take a look at the diff in this file:

====================
@@ -1361,7 +1361,6 @@ test:do_execsql_test(
         -- </13.8.3>
     })
 
-local V = "one"
 test:do_execsql_test(
     "13.8.4",
     [[
@@ -1372,7 +1371,6 @@ test:do_execsql_test(
         -- </13.8.4>
     })
 
-V = "two"
 test:do_execsql_test(
     "13.8.5",
     [[
@@ -1384,7 +1382,7 @@ test:do_execsql_test(
     })
 
 db("cache", "flush")
-V = "three"
+local V = "three" -- luacheck: no unused
====================

The comment wasn't about only "three". You shouldn't delete
"two" and "one", obviously. By the same reason. They are
"used" in these not working tests.

> diff --git a/test/sql-tap/select9.test.lua b/test/sql-tap/select9.test.lua
> index 4f7da84e2..045d0e4c8 100755
> --- a/test/sql-tap/select9.test.lua
> +++ b/test/sql-tap/select9.test.lua
> @@ -274,10 +274,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 _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
> +local _ = 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"]]]=])

t2_space_id is used in the commented code. But it looks already
corrupted, I can't even closely understand what is happening here.

t2_space_id and t1_space_id are obvious names anyway, so we probably could
just delete their declaration and assignment but keep t2_space_id usage
in the commented code.

Or comment them out too.

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-02-26 23:42       ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-02-27 17:09         ` Sergey Bronnikov via Tarantool-patches
  2021-02-28 15:30           ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-02-27 17:09 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Hello!

On 27.02.2021 02:42, Vladislav Shpilevoy wrote:
> Thanks for the fixes!
>
>>>> diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
>>>> index 9cd517673..5dab23007 100755
>>>> --- a/test/sql-tap/func.test.lua
>>>> +++ b/test/sql-tap/func.test.lua
>>>> @@ -1382,7 +1380,6 @@ test:do_execsql_test(
>>>>        })
>>>>      db("cache", "flush")
>>>> -V = "three"
>>> 2. 'V' is supposed to be a variable. It is used in the queries
>>> in the surrounding code. Please, don't delete parts of the tests.
>>> It will not make it simpler to restore the context later. The tests
>>> in this patchset either must be deleted, or resurrected, or hacked
>>> to keep their context and not fail luacheck. What to choose - depends
>>> on individual tests. Here clearly we need to keep 'V'. Try to make
>>> another pass of self-review to locate more of such test-"breaking"
>>> changes.
>> reverted and suppressed
>>
>> --- a/test/sql-tap/func.test.lua
>> +++ b/test/sql-tap/func.test.lua
>> @@ -1382,6 +1382,7 @@ test:do_execsql_test(
>>       })
>>
>>   db("cache", "flush")
>> +local V = "three" -- luacheck: no unused
>>   test:do_execsql_test(
>>       "13.8.6",
>>       [[
> Now take a look at the diff in this file:
>
> ====================
> @@ -1361,7 +1361,6 @@ test:do_execsql_test(
>           -- </13.8.3>
>       })
>   
> -local V = "one"
>   test:do_execsql_test(
>       "13.8.4",
>       [[
> @@ -1372,7 +1371,6 @@ test:do_execsql_test(
>           -- </13.8.4>
>       })
>   
> -V = "two"
>   test:do_execsql_test(
>       "13.8.5",
>       [[
> @@ -1384,7 +1382,7 @@ test:do_execsql_test(
>       })
>   
>   db("cache", "flush")
> -V = "three"
> +local V = "three" -- luacheck: no unused
> ====================
>
> The comment wasn't about only "three". You shouldn't delete
> "two" and "one", obviously. By the same reason. They are
> "used" in these not working tests.
Agree, looks bad. Fixed for "one" and "two" too.
>> diff --git a/test/sql-tap/select9.test.lua b/test/sql-tap/select9.test.lua
>> index 4f7da84e2..045d0e4c8 100755
>> --- a/test/sql-tap/select9.test.lua
>> +++ b/test/sql-tap/select9.test.lua
>> @@ -274,10 +274,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 _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
>> +local _ = 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"]]]=])
> t2_space_id is used in the commented code. But it looks already
> corrupted, I can't even closely understand what is happening here.

I read a history of commits for select9.test.lua and "t{1,2}_space_id" 
haven't changed since initial import.

See [1].

> t2_space_id and t1_space_id are obvious names anyway, so we probably could
> just delete their declaration and assignment but keep t2_space_id usage
> in the commented code.
>
> Or comment them out too.

removed:

--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -274,10 +274,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 _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
+local _ = 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"]]]=])

1. 
https://github.com/tarantool/tarantool/commit/47b70d97579a0f9fb59ab122cc97cea4a616be3d#diff-e2e23d907919e91e8ea29b579fd5caa73fd7526b242f65688c2c3939a45372a7R276-R279


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
  2021-02-26 23:42   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-02-27 17:53     ` Sergey Bronnikov via Tarantool-patches
  2021-02-28 15:30       ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-02-27 17:53 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Hello!

On 27.02.2021 02:42, Vladislav Shpilevoy wrote:
> Hi again! Thanks for the fixes!
>
>>>> -if 0>0 then
>>>> -db("nullvalue", "null")
>>>>   test:do_select_tests(
>>>>       "e_select-7.9",
>>>>       {
>>>> -        {"1", "SELECT NULL UNION ALL SELECT NULL", {null, null}},
>>>> -        {"2", "SELECT NULL UNION     SELECT NULL", {null}},
>>>> -        {"3", "SELECT NULL INTERSECT SELECT NULL", {null}},
>>>> +        {"1", "SELECT NULL UNION ALL SELECT NULL", {"", ""}},
>>>> +        {"2", "SELECT NULL UNION     SELECT NULL", {""}},
>>>> +        {"3", "SELECT NULL INTERSECT SELECT NULL", {""}},
>>>>           {"4", "SELECT NULL EXCEPT    SELECT NULL", {}},
>>> 2. But why? What was the effect of `db("nullvalue", "null")` in the
>>> original tests? If you don't know then maybe it is worth leaving it
>>> as is + adding `local null = box.NULL` or `local null = nil` so at
>>> least we could preserve the test body unchanged for future
>>> investigations.
>> Well, reverted hunks back and disabled testcase in the test.
>>
>> I found a source code of original test [1] and it is not clear
>>
>> why "nullvalue" redefined there.
>>
>> 1. https://www.sqlite.org/src/file?ci=trunk&name=test%2Fe_select.test&ln=1504
> It is not 'redefinition' it seems.
> https://www.oreilly.com/library/view/using-sqlite/9781449394592/re64.html
>
> It is a marker for output. From what I understood, sqlite prints NULLs as
> empty string, and here in the test they wanted to look for NULLs in the
> result. But you can't look for N empty strings. So NULL's string representation
> was replaced with "null" temporary. In our case it won't happen because we
> know number of returned columns and their exact values. Somebody will find
> the same in the future and will either fix or delete the test.
>
> See 4 more comments below and diff in the end of the email.
>
>> diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
>> index b22f195ca..4704970c8 100755
>> --- a/test/sql-tap/lua_sql.test.lua
>> +++ b/test/sql-tap/lua_sql.test.lua
>> @@ -75,9 +75,10 @@ box.schema.func.create('CHECK_FROM_SQL_TO_LUA', {language = 'Lua',
>>                          exports = {'LUA', 'SQL'}})
>>   
>>   -- check for different types
>> -for i = 1, #from_sql_to_lua, 1 do
>> +for i = 1, #from_sql_to_lua, 1 do -- luacheck: ignore from_sql_to_lua
>>       test:do_execsql_test(
>>           "lua_sql-2.2."..i,
>> +        -- luacheck: ignore from_sql_to_lua
> 1. You can just declare local from_sql_to_lua and also save it to _G. No
> need to ignore it.
Thanks for solution, it's definitely better than suppression.
>>           "select check_from_sql_to_lua("..i..","..from_sql_to_lua[i][1]..")",
>>           {1})
>>   end
>> @@ -102,9 +103,10 @@ box.schema.func.create('CHECK_FROM_LUA_TO_SQL', {language = 'Lua',
>>                          exports = {'LUA', 'SQL'}})
>>   
>>   -- check for different types
>> -for i = 1, #from_lua_to_sql, 1 do
>> +for i = 1, #from_lua_to_sql, 1 do -- luacheck: ignore from_lua_to_sql
>>       test:do_execsql_test(
>>           "lua_sql-2.3."..i,
>> +        -- luacheck: ignore from_lua_to_sql
>>           "select "..tostring(from_lua_to_sql[i][1]).." = check_from_lua_to_sql("..i..")",
>>           {true})
>>   end
>> diff --git a/test/sql-tap/minmax2.test.lua b/test/sql-tap/minmax2.test.lua
>> index f3d608aab..b6c02a4cc 100755
>> --- a/test/sql-tap/minmax2.test.lua
>> +++ b/test/sql-tap/minmax2.test.lua
>> @@ -72,6 +72,7 @@ test:do_test(
>>   test:do_test(
>>       "minmax2-1.2",
>>       function()
>> +        -- luacheck: ignore sql_search_count
>>           return box.stat.sql().sql_search_count - sql_search_count
> 2. There is no reason for sql_search_count to be global.
>
made it local
>>       end, 19)
>>   
>> @@ -89,6 +90,7 @@ test:do_test(
>>   test:do_test(
>>       "minmax2-1.4",
>>       function()
>> +        -- luacheck: ignore sql_search_count
>>           return box.stat.sql().sql_search_count - sql_search_count
>>       end, 19)
>>   
>> diff --git a/test/sql-tap/subquery.test.lua b/test/sql-tap/subquery.test.lua
>> index f57a22624..bb03f25ab 100755
>> --- a/test/sql-tap/subquery.test.lua
>> +++ b/test/sql-tap/subquery.test.lua
>> @@ -684,6 +684,8 @@ test:do_test(
>>           -- This is the key test.  The subquery should have only run once.  If
>>           -- The double-quoted identifier "two" were causing the subquery to be
>>           -- processed as a correlated subquery, then it would have run 4 times.
>> +
>> +        -- luacheck: ignore callcnt
>>           return callcnt
> 3. This can be fixed, lets not ignore it. One way would be
> to store callcnt in a table which is saved in a local variable
> and into _G.
>
> 	local callcnt = {value = 0}
> 	_G.callcnt = callcnt
>
> Then you can use callcnt.value from anywhere to reference the
> same counter.
>
> Another way is to have it local and update it via a function
> stored in _G.
>
> Also can simply write _G.callcnt in 3 more places instead of
> ignoring it.
Done
>
>>       end, 1)
>>   
>> @@ -706,7 +708,9 @@ test:do_test(
>>   test:do_test(
>>       "subquery-6.2",
>>       function()
>> +        -- luacheck: ignore callcnt
>>           return callcnt
>> +
>>       end, 4)
>>   
>>   test:do_test(
>> @@ -725,6 +729,7 @@ test:do_test(
>>   test:do_test(
>>       "subquery-6.4",
>>       function()
>> +        -- luacheck: ignore callcnt
>>           return callcnt
>>       end, 1)
>>   
>> diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua
>> index e95641938..7d496bc4d 100755
>> --- a/test/sql-tap/triggerC.test.lua
>> +++ b/test/sql-tap/triggerC.test.lua
>> @@ -791,7 +791,6 @@ for testno, v in ipairs(tests11) do
>>                   SELECT a,b FROM log;
>>               ]]
>>           end, {
>> -            defaults
> 4. The variable is supposed to be filled with something, from
> what I see in the commented code.
>
> You can declare it with nil somewhere above to keep the not
> working tests intact.

luacheck doesn't warn about it and tests passed successfully.

Although from code style point of view it's better to define it...


--- a/test/sql-tap/triggerC.test.lua
+++ b/test/sql-tap/triggerC.test.lua
@@ -779,6 +779,8 @@ for testno, v in ipairs(tests11) do
      --         -- X(891, "X!cmd", 
[=[["concat",["defaults"],["defaults"]]]=])
      --     })

+    -- Legacy from the original code. Must be replaced with valid value.
+    local defaults = nil
      test:do_test(
          "triggerC-11."..testno..".3",
          function()
@@ -790,6 +792,7 @@ for testno, v in ipairs(tests11) do
                  SELECT a,b FROM log;
              ]]
          end, {
+            defaults
          })

      --

>>           })
>>   
>>       --
>> diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua
>> index 2f1af29b0..40fc71998 100755
>> --- a/test/sql-tap/view.test.lua
>> +++ b/test/sql-tap/view.test.lua
>> @@ -1119,6 +1093,9 @@ if (0 > 0)
>>               -- </view-22.1>
>>           })
>>   
>> +    -- Legacy from the original code. Must be replaced with analogue
>> +    -- functions from box.
>> +    local X = nil
>>       test:do_test(
>>           "view-22.2",
>>           function()
> I tried to fix some of my comments:
>
> ====================
> diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
> index 4704970c8..d073ffe4f 100755
> --- a/test/sql-tap/lua_sql.test.lua
> +++ b/test/sql-tap/lua_sql.test.lua
> @@ -51,7 +51,7 @@ for _, val in ipairs({
>           {result})
>   end
>   
> -_G.from_sql_to_lua = {
> +local from_sql_to_lua = {
>       [1] = {1, 1},
>       [2] = {"1", 1},
>       [3] = {"1.5", 1.5},
> @@ -60,6 +60,7 @@ _G.from_sql_to_lua = {
>       [6] = {"x'0500'", "\u{0005}\u{0000}"},
>       [7] = {"123123123123123", 123123123123123LL},
>   }
> +_G.from_sql_to_lua = from_sql_to_lua
>   
>   box.schema.func.create('CHECK_FROM_SQL_TO_LUA', {language = 'Lua',
>                          is_deterministic = true,
> @@ -75,10 +76,9 @@ box.schema.func.create('CHECK_FROM_SQL_TO_LUA', {language = 'Lua',
>                          exports = {'LUA', 'SQL'}})
>   
>   -- check for different types
> -for i = 1, #from_sql_to_lua, 1 do -- luacheck: ignore from_sql_to_lua
> +for i = 1, #from_sql_to_lua, 1 do
>       test:do_execsql_test(
>           "lua_sql-2.2."..i,
> -        -- luacheck: ignore from_sql_to_lua
>           "select check_from_sql_to_lua("..i..","..from_sql_to_lua[i][1]..")",
>           {1})
>   end
> diff --git a/test/sql-tap/minmax2.test.lua b/test/sql-tap/minmax2.test.lua
> index b6c02a4cc..6a7859d42 100755
> --- a/test/sql-tap/minmax2.test.lua
> +++ b/test/sql-tap/minmax2.test.lua
> @@ -56,12 +56,12 @@ test:do_execsql_test(
>           -- </minmax2-1.0>
>       })
>   
> -_G.sql_search_count = 0
> +local sql_search_count = 0
>   
>   test:do_test(
>       "minmax2-1.1",
>       function()
> -        _G.sql_search_count = box.stat.sql().sql_search_count
> +        sql_search_count = box.stat.sql().sql_search_count
>           return test:execsql "SELECT min(x) FROM t1"
>       end, {
>           -- <minmax2-1.1>
> @@ -72,14 +72,13 @@ test:do_test(
>   test:do_test(
>       "minmax2-1.2",
>       function()
> -        -- luacheck: ignore sql_search_count
>           return box.stat.sql().sql_search_count - sql_search_count
>       end, 19)
>   
>   test:do_test(
>       "minmax2-1.3",
>       function()
> -        _G.sql_search_count = box.stat.sql().sql_search_count
> +        sql_search_count = box.stat.sql().sql_search_count
>           return test:execsql "SELECT max(x) FROM t1"
>       end, {
>           -- <minmax2-1.3>
> @@ -90,7 +89,6 @@ test:do_test(
>   test:do_test(
>       "minmax2-1.4",
>       function()
> -        -- luacheck: ignore sql_search_count
>           return box.stat.sql().sql_search_count - sql_search_count
>       end, 19)
>   
> @@ -98,7 +96,7 @@ test:do_test(
>       "minmax2-1.5",
>       function()
>           test:execsql "CREATE INDEX t1i1 ON t1(x DESC)"
> -        _G.sql_search_count = box.stat.sql().sql_search_count
> +        sql_search_count = box.stat.sql().sql_search_count
>           return test:execsql "SELECT min(x) FROM t1"
>       end, {
>           -- <minmax2-1.5>
> @@ -109,13 +107,13 @@ test:do_test(
>   test:do_test(
>       "minmax2-1.6",
>       function()
> -        return box.stat.sql().sql_search_count - _G.sql_search_count
> +        return box.stat.sql().sql_search_count - sql_search_count
>       end, 1)
>   
>   test:do_test(
>       "minmax2-1.7",
>       function()
> -        _G.sql_search_count = box.stat.sql().sql_search_count
> +        sql_search_count = box.stat.sql().sql_search_count
>           return test:execsql "SELECT max(x) FROM t1"
>       end, {
>           -- <minmax2-1.7>
> @@ -126,13 +124,13 @@ test:do_test(
>   test:do_test(
>       "minmax2-1.8",
>       function()
> -        return box.stat.sql().sql_search_count - _G.sql_search_count
> +        return box.stat.sql().sql_search_count - sql_search_count
>       end, 0)
>   
>   test:do_test(
>       "minmax2-1.9",
>       function()
> -        _G.sql_search_count = box.stat.sql().sql_search_count
> +        sql_search_count = box.stat.sql().sql_search_count
>           return test:execsql "SELECT max(y) FROM t1"
>       end, {
>           -- <minmax2-1.9>
> @@ -143,7 +141,7 @@ test:do_test(
>   test:do_test(
>       "minmax2-1.10",
>       function()
> -        return box.stat.sql().sql_search_count - _G.sql_search_count
> +        return box.stat.sql().sql_search_count - sql_search_count
>       end, 19)
>   
>   test:do_test(
> @@ -153,7 +151,7 @@ test:do_test(
>               CREATE TABLE t2(a INTEGER PRIMARY KEY, b INT );
>               INSERT INTO t2 SELECT x, y FROM t1;
>           ]]
> -        _G.sql_search_count = box.stat.sql().sql_search_count
> +        sql_search_count = box.stat.sql().sql_search_count
>           return test:execsql "SELECT min(a) FROM t2"
>       end, {
>           -- <minmax2-2.0>
> @@ -164,13 +162,13 @@ test:do_test(
>   test:do_test(
>       "minmax2-2.1",
>       function()
> -        return box.stat.sql().sql_search_count - _G.sql_search_count
> +        return box.stat.sql().sql_search_count - sql_search_count
>       end, 0)
>   
>   test:do_test(
>       "minmax2-2.2",
>       function()
> -        _G.sql_search_count = box.stat.sql().sql_search_count
> +        sql_search_count = box.stat.sql().sql_search_count
>           return test:execsql "SELECT max(a) FROM t2"
>       end, {
>           -- <minmax2-2.2>
> @@ -181,7 +179,7 @@ test:do_test(
>   test:do_test(
>       "minmax2-2.3",
>       function()
> -        return box.stat.sql().sql_search_count - _G.sql_search_count
> +        return box.stat.sql().sql_search_count - sql_search_count
>       end, 0)
>   
>   test:do_test(
> @@ -190,7 +188,7 @@ test:do_test(
>           test:execsql "INSERT INTO t2 VALUES((SELECT max(a) FROM t2)+1,999)"
>   
>   
> -        _G.sql_search_count = box.stat.sql().sql_search_count
> +        sql_search_count = box.stat.sql().sql_search_count
>           return test:execsql "SELECT max(a) FROM t2"
>       end, {
>           -- <minmax2-3.0>
> @@ -201,7 +199,7 @@ test:do_test(
>   test:do_test(
>       "minmax2-3.1",
>       function()
> -        return box.stat.sql().sql_search_count - _G.sql_search_count
> +        return box.stat.sql().sql_search_count - sql_search_count
>       end, 0)
>   
>   test:do_test(
> @@ -210,7 +208,7 @@ test:do_test(
>           test:execsql "INSERT INTO t2 VALUES((SELECT max(a) FROM t2)+1,999)"
>   
>   
> -        _G.sql_search_count = box.stat.sql().sql_search_count
> +        sql_search_count = box.stat.sql().sql_search_count
>           return test:execsql " SELECT b FROM t2 WHERE a=(SELECT max(a) FROM t2) "
>   
>   
> @@ -224,7 +222,7 @@ test:do_test(
>   test:do_test(
>       "minmax2-3.3",
>       function()
> -        return box.stat.sql().sql_search_count - _G.sql_search_count
> +        return box.stat.sql().sql_search_count - sql_search_count
>       end, 1)
>   
>   test:do_execsql_test(
> diff --git a/test/sql-tap/subquery.test.lua b/test/sql-tap/subquery.test.lua
> index bb03f25ab..df3075ee3 100755
> --- a/test/sql-tap/subquery.test.lua
> +++ b/test/sql-tap/subquery.test.lua
> @@ -685,8 +685,7 @@ test:do_test(
>           -- The double-quoted identifier "two" were causing the subquery to be
>           -- processed as a correlated subquery, then it would have run 4 times.
>   
> -        -- luacheck: ignore callcnt
> -        return callcnt
> +        return _G.callcnt
>       end, 1)
>   
>   -- Ticket #1380.  Make sure correlated subqueries on an IN clause work
> @@ -708,8 +707,7 @@ test:do_test(
>   test:do_test(
>       "subquery-6.2",
>       function()
> -        -- luacheck: ignore callcnt
> -        return callcnt
> +        return _G.callcnt
>   
>       end, 4)
>   
> @@ -729,8 +727,7 @@ test:do_test(
>   test:do_test(
>       "subquery-6.4",
>       function()
> -        -- luacheck: ignore callcnt
> -        return callcnt
> +        return _G.callcnt
>       end, 1)
>   
>   box.func.CALLCNT:drop()
>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
  2021-02-27 17:53     ` Sergey Bronnikov via Tarantool-patches
@ 2021-02-28 15:30       ` Vladislav Shpilevoy via Tarantool-patches
  2021-03-01 13:26         ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-02-28 15:30 UTC (permalink / raw)
  To: Sergey Bronnikov, tarantool-patches

Hi again!

> diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
> index b22f195ca..0f6360dd4 100755
> --- a/test/sql-tap/lua_sql.test.lua
> +++ b/test/sql-tap/lua_sql.test.lua
> @@ -102,9 +104,10 @@ box.schema.func.create('CHECK_FROM_LUA_TO_SQL', {language = 'Lua',
>                         exports = {'LUA', 'SQL'}})
>  
>  -- check for different types
> -for i = 1, #from_lua_to_sql, 1 do
> +for i = 1, #from_lua_to_sql, 1 do -- luacheck: ignore from_lua_to_sql
>      test:do_execsql_test(
>          "lua_sql-2.3."..i,
> +        -- luacheck: ignore from_lua_to_sql

Why do you need these ignores now?

>          "select "..tostring(from_lua_to_sql[i][1]).." = check_from_lua_to_sql("..i..")",
>          {true})
>  end

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-02-27 17:09         ` Sergey Bronnikov via Tarantool-patches
@ 2021-02-28 15:30           ` Vladislav Shpilevoy via Tarantool-patches
  2021-03-01 13:46             ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-02-28 15:30 UTC (permalink / raw)
  To: Sergey Bronnikov, tarantool-patches

Thanks for the fixes!

> --- a/test/sql-tap/select9.test.lua
> +++ b/test/sql-tap/select9.test.lua
> @@ -274,10 +274,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 _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
> +local _ = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]

But nothing changed. It was the same before my comment. By 'delete' them I
mean literally 'delete'. SELECTs don't have any effect unlike DML/DDL. You
can remove them and nothing will change.

====================
     })
 
-local _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
-local _ = 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"]]=])
====================

However even if we would would to keep them you wouldn't need `local _ = `.
You can call functions without saving their result into a variable.

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
  2021-02-28 15:30       ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-03-01 13:26         ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-03-01 13:26 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Hello!

On 28.02.2021 18:30, Vladislav Shpilevoy wrote:
> Hi again!
>
>> diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
>> index b22f195ca..0f6360dd4 100755
>> --- a/test/sql-tap/lua_sql.test.lua
>> +++ b/test/sql-tap/lua_sql.test.lua
>> @@ -102,9 +104,10 @@ box.schema.func.create('CHECK_FROM_LUA_TO_SQL', {language = 'Lua',
>>                          exports = {'LUA', 'SQL'}})
>>   
>>   -- check for different types
>> -for i = 1, #from_lua_to_sql, 1 do
>> +for i = 1, #from_lua_to_sql, 1 do -- luacheck: ignore from_lua_to_sql
>>       test:do_execsql_test(
>>           "lua_sql-2.3."..i,
>> +        -- luacheck: ignore from_lua_to_sql
> Why do you need these ignores now?

Applied solution to `from_sql_to_lua` and missed that there is 
`from_lua_to_sql`.

Fixed with patch below:


--- a/test/sql-tap/lua_sql.test.lua
+++ b/test/sql-tap/lua_sql.test.lua
@@ -84,7 +84,7 @@ for i = 1, #from_sql_to_lua, 1 do
          {1})
  end

-_G.from_lua_to_sql = {
+local from_lua_to_sql = {
      [1] = {1, 1},
      [2] = {"1.5", 1.5},
      [3] = {"'1'", "1"},
@@ -93,6 +93,8 @@ _G.from_lua_to_sql = {
      [6] = {12, 12LL},
  }

+_G.from_lua_to_sql = from_lua_to_sql
+
  box.schema.func.create('CHECK_FROM_LUA_TO_SQL', {language = 'Lua',
                         is_deterministic = true,
                         body = [[
@@ -104,10 +106,9 @@ box.schema.func.create('CHECK_FROM_LUA_TO_SQL', 
{language = 'Lua',
                         exports = {'LUA', 'SQL'}})

  -- check for different types
-for i = 1, #from_lua_to_sql, 1 do -- luacheck: ignore from_lua_to_sql
+for i = 1, #from_lua_to_sql, 1 do
      test:do_execsql_test(
          "lua_sql-2.3."..i,
-        -- luacheck: ignore from_lua_to_sql
          "select "..tostring(from_lua_to_sql[i][1]).." = 
check_from_lua_to_sql("..i..")",
          {true})
  end


>
>>           "select "..tostring(from_lua_to_sql[i][1]).." = check_from_lua_to_sql("..i..")",
>>           {true})
>>   end

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-02-28 15:30           ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-03-01 13:46             ` Sergey Bronnikov via Tarantool-patches
  2021-03-01 21:27               ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-03-01 13:46 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Hello!

On 28.02.2021 18:30, Vladislav Shpilevoy wrote:
> Thanks for the fixes!
>
>> --- a/test/sql-tap/select9.test.lua
>> +++ b/test/sql-tap/select9.test.lua
>> @@ -274,10 +274,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 _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
>> +local _ = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
> But nothing changed. It was the same before my comment. By 'delete' them I
> mean literally 'delete'. SELECTs don't have any effect unlike DML/DDL. You
> can remove them and nothing will change.
>
> ====================

It was a misunderstanding. Removed it now.

--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -274,8 +274,6 @@ test:do_execsql_test(
          -- </select9-2.0>
      })

-local _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
-local _ = 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"]]]=])

>       })
>   
> -local _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
> -local _ = 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"]]=])
> ====================
>
> However even if we would would to keep them you wouldn't need `local _ = `.
> You can call functions without saving their result into a variable.

luacheck reports an error when result of function is not assigned to 
variable.

With patch:

--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -274,8 +274,7 @@ test:do_execsql_test(
          -- </select9-2.0>
      })

-local _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
-local _ = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
+test:execsql([[SELECT * from "_space" where "name"='T1']])["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"]]]=])

it reports:

Checking test/sql-tap/select9.test.lua            1 error

     test/sql-tap/select9.test.lua:289:1: (E011) expected '=' near 
'iOuterLoop'

Total: 0 warnings / 1 error in 264 files


iOuterLoop is a variable on a next uncommented line. Seems Lua requires 
that function's result must be assigned to variable.


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-03-01 13:46             ` Sergey Bronnikov via Tarantool-patches
@ 2021-03-01 21:27               ` Vladislav Shpilevoy via Tarantool-patches
  2021-03-02  8:05                 ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-03-01 21:27 UTC (permalink / raw)
  To: Sergey Bronnikov, tarantool-patches

> --- a/test/sql-tap/select9.test.lua
> +++ b/test/sql-tap/select9.test.lua
> @@ -274,8 +274,6 @@ test:do_execsql_test(
>          -- </select9-2.0>
>      })
> 
> -local _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
> -local _ = 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"]]]=])
> 
>>       })
>>   -local _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
>> -local _ = 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"]]=])
>> ====================
>>
>> However even if we would would to keep them you wouldn't need `local _ = `.
>> You can call functions without saving their result into a variable.
> 
> luacheck reports an error when result of function is not assigned to variable.
> 
> With patch:
> 
> --- a/test/sql-tap/select9.test.lua
> +++ b/test/sql-tap/select9.test.lua
> @@ -274,8 +274,7 @@ test:do_execsql_test(
>          -- </select9-2.0>
>      })
> 
> -local _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
> -local _ = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
> +test:execsql([[SELECT * from "_space" where "name"='T1']])["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"]]]=])
> 
> it reports:
> 
> Checking test/sql-tap/select9.test.lua            1 error
> 
>     test/sql-tap/select9.test.lua:289:1: (E011) expected '=' near 'iOuterLoop'
> 
> Total: 0 warnings / 1 error in 264 files
> 
> 
> iOuterLoop is a variable on a next uncommented line. Seems Lua requires that function's result must be assigned to variable.

That is hardly possible. We have Lua calls not saved into anything.
For instance, grep fiber.name(...) calls.

I suspect it is because you left ["id"] thing after the call. Because
result of [] indeed makes no sense without being used.

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (13 preceding siblings ...)
  2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 14/14] luacheck: add issues for suppressed warnings Sergey Bronnikov via Tarantool-patches
@ 2021-03-01 21:37 ` Vladislav Shpilevoy via Tarantool-patches
  2021-03-02  9:47 ` Kirill Yukhin via Tarantool-patches
  15 siblings, 0 replies; 47+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-03-01 21:37 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Hi! Thanks for the patchset!

LGTM.

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 in test/sql-tap
  2021-03-01 21:27               ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-03-02  8:05                 ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 47+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-03-02  8:05 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Hi!

On 02.03.2021 00:27, Vladislav Shpilevoy wrote:
>> --- a/test/sql-tap/select9.test.lua
>> +++ b/test/sql-tap/select9.test.lua
>> @@ -274,8 +274,6 @@ test:do_execsql_test(
>>           -- </select9-2.0>
>>       })
>>
>> -local _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
>> -local _ = 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"]]]=])
>>
>>>        })
>>>    -local _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
>>> -local _ = 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"]]=])
>>> ====================
>>>
>>> However even if we would would to keep them you wouldn't need `local _ = `.
>>> You can call functions without saving their result into a variable.
>> luacheck reports an error when result of function is not assigned to variable.
>>
>> With patch:
>>
>> --- a/test/sql-tap/select9.test.lua
>> +++ b/test/sql-tap/select9.test.lua
>> @@ -274,8 +274,7 @@ test:do_execsql_test(
>>           -- </select9-2.0>
>>       })
>>
>> -local _ = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
>> -local _ = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
>> +test:execsql([[SELECT * from "_space" where "name"='T1']])["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"]]]=])
>>
>> it reports:
>>
>> Checking test/sql-tap/select9.test.lua            1 error
>>
>>      test/sql-tap/select9.test.lua:289:1: (E011) expected '=' near 'iOuterLoop'
>>
>> Total: 0 warnings / 1 error in 264 files
>>
>>
>> iOuterLoop is a variable on a next uncommented line. Seems Lua requires that function's result must be assigned to variable.
> That is hardly possible. We have Lua calls not saved into anything.
> For instance, grep fiber.name(...) calls.
>
> I suspect it is because you left ["id"] thing after the call. Because
> result of [] indeed makes no sense without being used.

Looks so.

$ cat sample.lua
function aaa()
     return {}
end

aaa()
aaa()['id']

local b = 'dd'

$ luacheck --codes sample.lua
Checking sample.lua                               1 error

     sample.lua:8:1: (E011) expected '=' near 'local'

Total: 0 warnings / 1 error in 1 file


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap
  2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
                   ` (14 preceding siblings ...)
  2021-03-01 21:37 ` [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Vladislav Shpilevoy via Tarantool-patches
@ 2021-03-02  9:47 ` Kirill Yukhin via Tarantool-patches
  15 siblings, 0 replies; 47+ messages in thread
From: Kirill Yukhin via Tarantool-patches @ 2021-03-02  9:47 UTC (permalink / raw)
  To: sergeyb; +Cc: tarantool-patches, v.shpilevoy

Hello,

On 21 янв 15:49, Sergey Bronnikov via Tarantool-patches wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> Changelog v8:
> 
> - re-made patches for sql-tap suite
> - removed fixes suppressed globally in .luacheckrc (like upvalue redefinitions)
> - splitted huge patch to a number of patches per warning
> - rebased to a master branch
> 
> Changelog v7:
> 
> - fixed warnings in a new code
> - rebased to master branch
> 
> Changelog v6:
> 
> - splitted patch in test/ for patches per sub-directory
> - adjusted suppressions in .luacheckrc
> - fixed formatting issues in .luacheckrc
> 
> Note that a number of tests in sql-tap are broken (see suite.ini) and luacheck
> fixes cannot be verified with running tests.
> 
> Gitlab CI: https://gitlab.com/tarantool/tarantool/-/pipelines/244912620
> Branch: ligurio/gh-5463-luacheck-warnings-test-sql
> Issues:
>   - https://github.com/tarantool/tarantool/issues/5464
>   - https://github.com/tarantool/tarantool/issues/5463
>   - https://github.com/tarantool/tarantool/issues/5741
> 
> Sergey Bronnikov (14):
>   test: fix luacheck warnings in test/sql
>   test: remove functions to open and close SQL connection
>   test: fix luacheck warnings W113 in test/sql-tap
>   test: fix luacheck warnings W211 in test/sql-tap
>   test: fix luacheck warnings W212 in test/sql-tap
>   test: fix laucheck warnings W213 in test/sql-tap
>   test: fix luacheck warnings W231 in test/sql-tap
>   test: fix luacheck warnings W311 in test/sql-tap
>   test: fix luacheck warnings W511 in test/sql-tap
>   test: fix luacheck warnings W512 in test/sql-tap
>   test: fix luacheck warnings W542 in test/sql-tap
>   test: fix luacheck warnings W612, W613, W614 in test/sql-tap
>   test: fix luacheck warnings W621 in test/sql-tap
>   luacheck: add issues for suppressed warnings

I've checked your patch set into 2.6, 2.7 and master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2021-03-02  9:47 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 01/14] test: fix luacheck warnings in test/sql Sergey Bronnikov via Tarantool-patches
2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 02/14] test: remove functions to open and close SQL connection Sergey Bronnikov via Tarantool-patches
2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap Sergey Bronnikov via Tarantool-patches
2021-01-24 17:33   ` Vladislav Shpilevoy via Tarantool-patches
2021-02-06 17:52     ` Vladislav Shpilevoy via Tarantool-patches
2021-02-16 12:02     ` Sergey Bronnikov via Tarantool-patches
2021-02-23 21:25       ` Vladislav Shpilevoy via Tarantool-patches
2021-02-25 10:39         ` Sergey Bronnikov via Tarantool-patches
2021-02-26 23:42   ` Vladislav Shpilevoy via Tarantool-patches
2021-02-27 17:53     ` Sergey Bronnikov via Tarantool-patches
2021-02-28 15:30       ` Vladislav Shpilevoy via Tarantool-patches
2021-03-01 13:26         ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 " Sergey Bronnikov via Tarantool-patches
2021-01-24 17:34   ` Vladislav Shpilevoy via Tarantool-patches
2021-02-16 14:09     ` Sergey Bronnikov via Tarantool-patches
2021-02-23 21:26   ` Vladislav Shpilevoy via Tarantool-patches
2021-02-25 11:02     ` Sergey Bronnikov via Tarantool-patches
2021-02-26 23:42       ` Vladislav Shpilevoy via Tarantool-patches
2021-02-27 17:09         ` Sergey Bronnikov via Tarantool-patches
2021-02-28 15:30           ` Vladislav Shpilevoy via Tarantool-patches
2021-03-01 13:46             ` Sergey Bronnikov via Tarantool-patches
2021-03-01 21:27               ` Vladislav Shpilevoy via Tarantool-patches
2021-03-02  8:05                 ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 05/14] test: fix luacheck warnings W212 " Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 06/14] test: fix laucheck warnings W213 " Sergey Bronnikov via Tarantool-patches
2021-01-24 17:35   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-29 16:32     ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 07/14] test: fix luacheck warnings W231 " Sergey Bronnikov via Tarantool-patches
2021-01-24 17:35   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-29 22:39     ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 08/14] test: fix luacheck warnings W311 " Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 09/14] test: fix luacheck warnings W511 " Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 10/14] test: fix luacheck warnings W512 " Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 11/14] test: fix luacheck warnings W542 " Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 12/14] test: fix luacheck warnings W612, W613, W614 " Sergey Bronnikov via Tarantool-patches
2021-01-24 17:36   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-29 16:23     ` Sergey Bronnikov via Tarantool-patches
2021-01-29 21:50       ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 13/14] test: fix luacheck warnings W621 " Sergey Bronnikov via Tarantool-patches
2021-01-24 17:37   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-29 16:11     ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 14/14] luacheck: add issues for suppressed warnings Sergey Bronnikov via Tarantool-patches
2021-01-24 17:37   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-29 16:13     ` Sergey Bronnikov via Tarantool-patches
2021-03-01 21:37 ` [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Vladislav Shpilevoy via Tarantool-patches
2021-03-02  9:47 ` Kirill Yukhin via Tarantool-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox