From 17d78fab5dc8d96b7ebf8d6c5a901ddff1992fa7 Mon Sep 17 00:00:00 2001 From: Anton Shestakov Date: Sat, 23 Jul 2016 18:21:21 +0800 Subject: test_util_multitable: remove unused one-letter loop variable [luacheck] --- tests/test_util_multitable.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_util_multitable.lua b/tests/test_util_multitable.lua index 4a8dd14c..45727bc3 100644 --- a/tests/test_util_multitable.lua +++ b/tests/test_util_multitable.lua @@ -27,7 +27,7 @@ function get(get, multitable) return true, "has-all"; end for n=1,select('#', ...) do should_have[select(n, ...)] = true; end - for n, item in ipairs(list) do + for _, item in ipairs(list) do if not should_have[item] then return false, "too-many"; end should_have[item] = nil; end -- cgit v1.2.3 From 5585dc288f7aa744f1bda3eaebff79ef29e11f80 Mon Sep 17 00:00:00 2001 From: Anton Shestakov Date: Sat, 23 Jul 2016 18:21:35 +0800 Subject: test_util_uuid: remove unused one-letter loop variable [luacheck] --- tests/test_util_uuid.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_util_uuid.lua b/tests/test_util_uuid.lua index d3f72bb4..07d75025 100644 --- a/tests/test_util_uuid.lua +++ b/tests/test_util_uuid.lua @@ -13,7 +13,7 @@ local pattern = "^" .. table.concat({ }, "%-") .. "$"; function generate(generate) - for i = 1, 100 do + for _ = 1, 100 do assert_is(generate():match(pattern)); end end -- cgit v1.2.3 From 8e2e80c3f3b5330f64ec0cce849a1b6c027fffb2 Mon Sep 17 00:00:00 2001 From: Anton Shestakov Date: Sat, 23 Jul 2016 18:22:05 +0800 Subject: util.sql: remove unused one-letter loop variables [luacheck] --- util/sql.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/sql.lua b/util/sql.lua index 6fed1373..eb562eb2 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -49,7 +49,7 @@ end function table_mt:__tostring() local s = { 'name="'..self.__table__.name..'"' } - for i,col in ipairs(self.__table__) do + for _, col in ipairs(self.__table__) do s[#s+1] = tostring(col); end return 'Table{ '..t_concat(s, ", ")..' }' @@ -294,7 +294,7 @@ function engine:_create_table(table) end local success,err = self:execute(sql); if not success then return success,err; end - for i,v in ipairs(table.__table__) do + for _, v in ipairs(table.__table__) do if is_index(v) then self:_create_index(v); end -- cgit v1.2.3 From df7216ceb5cdf8ac50e9d6d4e14fd4efb56b6f9c Mon Sep 17 00:00:00 2001 From: Anton Shestakov Date: Sat, 23 Jul 2016 20:12:53 +0800 Subject: test_util_http: wrap individual test blocks in do-end [luacheck] --- tests/test_util_http.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/test_util_http.lua b/tests/test_util_http.lua index a195df6b..d9cc2779 100644 --- a/tests/test_util_http.lua +++ b/tests/test_util_http.lua @@ -25,13 +25,17 @@ function formencode(formencode) end function formdecode(formdecode) - local t = formdecode("one=1&two=2"); - assert_table(t[1]); - assert_equal(t[1].name, "one"); assert_equal(t[1].value, "1"); - assert_table(t[2]); - assert_equal(t[2].name, "two"); assert_equal(t[2].value, "2"); + do + local t = formdecode("one=1&two=2"); + assert_table(t[1]); + assert_equal(t[1].name, "one"); assert_equal(t[1].value, "1"); + assert_table(t[2]); + assert_equal(t[2].name, "two"); assert_equal(t[2].value, "2"); + end - local t = formdecode("one+two=1&two+one%26=2"); - assert_equal(t[1].name, "one two"); assert_equal(t[1].value, "1"); - assert_equal(t[2].name, "two one&"); assert_equal(t[2].value, "2"); + do + local t = formdecode("one+two=1&two+one%26=2"); + assert_equal(t[1].name, "one two"); assert_equal(t[1].value, "1"); + assert_equal(t[2].name, "two one&"); assert_equal(t[2].value, "2"); + end end -- cgit v1.2.3 From 2c6065e198926e5026d51a2b0effe9223dd2cd01 Mon Sep 17 00:00:00 2001 From: Anton Shestakov Date: Sat, 23 Jul 2016 20:24:14 +0800 Subject: test_utf8: remove 2 unused variables and an undefined variable [luacheck] --- tests/test_utf8.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_utf8.lua b/tests/test_utf8.lua index 481eff5d..db59a70f 100644 --- a/tests/test_utf8.lua +++ b/tests/test_utf8.lua @@ -11,7 +11,6 @@ function valid() if expect ~= "pass" and expect ~= "fail" then error("unknown expectation: "..line:match("^[^:]+")); end - local prefix, style = " ", valid_style; local valid = utf8.valid(data); assert_equal(valid, utf8.valid(data.." ")); assert_equal(valid, expect == "pass", line); -- cgit v1.2.3