From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 9323F6F3C7; Fri, 26 Mar 2021 17:55:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9323F6F3C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616770506; bh=T8xNN1xUAEhCkH4uwYJKgKWqcoOAXHrVMYZ/mBHfnhU=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=XV+21A7X1AjJmKmDRTUnUALtvZk/xAUNdM6A5n4qzhZCjM5FoLJhrZ5JTiReBGcNJ HCd62Y1HSMRB7RPa9dHmLyrPDaCsbm3kJUb9U10qFddMyAb9isCDpk4b9oR6h5RZgF NXJDky7pGLQ/StuwQcaePI9W6yZXKHAZuS/ZxaVU= Received: from smtp17.mail.ru (smtp17.mail.ru [94.100.176.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id EB5BF6F3C7 for ; Fri, 26 Mar 2021 17:55:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EB5BF6F3C7 Received: by smtp17.mail.ru with esmtpa (envelope-from ) id 1lPnrc-0006Pd-7X; Fri, 26 Mar 2021 17:55:04 +0300 Date: Fri, 26 Mar 2021 17:54:11 +0300 To: Sergey Ostanevich , Igor Munkin Cc: tarantool-patches@dev.tarantool.org Message-ID: References: <422eaeb77d4cb957338af0bdc0151ae7787e1567.1616743343.git.skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <422eaeb77d4cb957338af0bdc0151ae7787e1567.1616743343.git.skaplun@tarantool.org> X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32941B7C4A78AC10F96A7797F60C25BD4B06182A05F53808504041AEC2D52C262EB0E6407ABBB71D090C7A67938FD7B4CEE77F4C75F9217F40CC X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BC08626EA5717D14EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006377A06FA5CCF78F9BC8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C5DD32608FC869F5D0E1D6FF38462588D933C8728DCA2069AA471835C12D1D9774AD6D5ED66289B5259CC434672EE6371117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA71A620F70A64A45A98AA50765F790063735872C767BF85DA227C277FBC8AE2E8B47E915A23788DB9575ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A51A994ED69B5C3E7919E6B92A5B4D05C4DC3CCD1AD130EBE3D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348E5EF936B2E46EBA633D38E4E877DD371974056E0CB4CB9433E2EE267526B17A6FE7E5293C86F1731D7E09C32AA3244C013A5D34C296118DD3132967CC09578230452B15D76AEC14FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojapPp7P/VpAh/ornhe7Tw7w== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB495C519289575BF3160AB53D3718ED3226C253EDB8E9AB510F2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 20/30] test: adapt PUC Lua test for args in vararg func X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" I've changed s/first/local/ in the commit message and the comment, considering comment by Sergos for the previous patch. =================================================================== test: adapt PUC Lua test for args in vararg func Lua 5.1 interprets ... in the vararg functions like additional local argument, unlike LuaJIT does. All extra arguments is set into `arg` variable. Implicit `arg` parameter for old-style vararg functions was finally removed in Lua 5.2. This patch adjust tests in vararg.lua considering Lua 5.2 test suite taken from https://www.lua.org/tests/lua-5.2.0-tests.tar.gz. Closes tarantool/tarantool#5712 Part of tarantool/tarantool#5845 Part of tarantool/tarantool#4473 =================================================================== =================================================================== diff --git a/test/PUC-Lua-5.1-tests/vararg.lua b/test/PUC-Lua-5.1-tests/vararg.lua index efb76c5..4d6ec6d 100644 --- a/test/PUC-Lua-5.1-tests/vararg.lua +++ b/test/PUC-Lua-5.1-tests/vararg.lua @@ -3,7 +3,7 @@ print('testing vararg') _G.arg = nil -- Lua 5.1 interprets ... in the vararg functions like additional --- first argument, unlike LuaJIT does. All extra arguments is set +-- local argument, unlike LuaJIT does. All extra arguments is set -- into `arg` variable. This extension is from Lua 5.2. -- See also https://github.com/tarantool/tarantool/issues/5712. -- LuaJIT: Test is adapted from PUC-Rio Lua 5.2 test suite. =================================================================== On 26.03.21, Sergey Kaplun wrote: > Lua 5.1 interprets ... in the vararg functions like additional first > argument, unlike LuaJIT does. All extra arguments is set into `arg` > variable. > > Implicit `arg` parameter for old-style vararg functions was finally > removed in Lua 5.2. This patch adjust tests in vararg.lua considering > Lua 5.2 test suite taken from > https://www.lua.org/tests/lua-5.2.0-tests.tar.gz. > > Closes tarantool/tarantool#5712 > Part of tarantool/tarantool#5845 > Part of tarantool/tarantool#4473 > --- > test/PUC-Lua-5.1-tests/vararg.lua | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/test/PUC-Lua-5.1-tests/vararg.lua b/test/PUC-Lua-5.1-tests/vararg.lua > index ae068fa..efb76c5 100644 > --- a/test/PUC-Lua-5.1-tests/vararg.lua > +++ b/test/PUC-Lua-5.1-tests/vararg.lua > @@ -2,9 +2,13 @@ print('testing vararg') > > _G.arg = nil > > +-- Lua 5.1 interprets ... in the vararg functions like additional > +-- first argument, unlike LuaJIT does. All extra arguments is set > +-- into `arg` variable. This extension is from Lua 5.2. > +-- See also https://github.com/tarantool/tarantool/issues/5712. > +-- LuaJIT: Test is adapted from PUC-Rio Lua 5.2 test suite. > function f(a, ...) > - assert(type(arg) == 'table') > - assert(type(arg.n) == 'number') > + local arg = {n = select('#', ...), ...} > for i=1,arg.n do assert(a[i]==arg[i]) end > return arg.n > end > @@ -17,7 +21,9 @@ function c12 (...) > return res, 2 > end > > -function vararg (...) return arg end > +-- LuaJIT: Test chunk is adapted from PUC-Rio Lua 5.2 test suite. > +-- See the comment above. > +function vararg (...) return {n = select('#', ...), ...} end > > local call = function (f, args) return f(unpack(args, 1, args.n)) end > > @@ -42,7 +48,9 @@ a = call(print, {'+'}) > assert(a == nil) > > local t = {1, 10} > -function t:f (...) return self[arg[1]]+arg.n end > +-- LuaJIT: Test chunk is adapted from PUC-Rio Lua 5.2 test suite. > +-- See the comment above. > +function t:f (...) local arg = {...}; return self[...]+#arg end > assert(t:f(1,4) == 3 and t:f(2) == 11) > print('+') > > -- > 2.31.0 > -- Best regards, Sergey Kaplun