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 2E8666F3C7; Fri, 26 Mar 2021 18:22:17 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2E8666F3C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616772137; bh=PFdpjDFXRQcLloY2/1WRXGqLCSW2rXIIOg25dNEzBAc=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=yfzlRbRwGgB6G1SA06eKStP2PSuNxKUmRZMeeVsWov4iLJYKf/SyyRp4mnK7jxtR1 5ArpZJbCi2GHcs4ZSAeoAKIunroPrZ135UdJJoWLPbGmYoYmQZg50BwFUV7WIgQbfL h6OG0EhtSR9/QkcjGEDjhEJiLESqjNlJLSKttxMw= Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (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 2A0286F3C7 for ; Fri, 26 Mar 2021 18:22:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2A0286F3C7 Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1lPoHv-0003eZ-8J; Fri, 26 Mar 2021 18:22:15 +0300 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) In-Reply-To: Date: Fri, 26 Mar 2021 18:22:14 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <422eaeb77d4cb957338af0bdc0151ae7787e1567.1616743343.git.skaplun@tarantool.org> To: Sergey Kaplun X-Mailer: Apple Mail (2.3654.60.0.2.21) X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947A0146560F8BA709498CFB6209D8582A182A05F5380850402DF8DDDAEEFD98C8DF86F6DCE86C3F29A992741E0DB1A8FCE243E762B9465D5B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7DECE8D0A5E25C0FCEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637389D8DDD54F43F7A8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C5DD32608FC869F5D3E0CF53E917BC98AEA1660EBEE2F0263A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3ED8438A78DFE0A9E117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CF3A14BF2D23BF3F43BA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B6E67FAAB7D187F8DF76E601842F6C81A1F004C906525384307823802FF610243DF43C7A68FF6260569E8FC8737B5C2249B372FE9A2E580EFC725E5C173C3A84C3A1C30C8AFC676C8B35872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5026D448B447032B3D395607E988110E882D64314B1A3DB55D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3444047AE358B40754602F68FC4A8D752B9531877AD737CC6E21CBEEE11A6C3D8D47B4C19D113944A41D7E09C32AA3244C8A030AB68D9894FA9B67935CA72F3759B4DF56057A86259FFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojapPp7P/VpAi/qRpUon6KqA== X-Mailru-Sender: 455D65AE3A139168626D8C76E86D3AC00E75B0E66589C566C4735C7D67B7A708DDAC019A3742A8B676D79013C85012CDC77752E0C033A69E4BBE7EBD99111A499D0AB74157175C036C18EFA0BB12DBB0 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 Ostanevich via Tarantool-patches Reply-To: Sergey Ostanevich Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" LGTM. Sergos > On 26 Mar 2021, at 17:54, Sergey Kaplun wrote: >=20 >=20 > I've changed s/first/local/ in the commit message and the comment, > considering comment by Sergos for the previous patch. >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > test: adapt PUC Lua test for args in vararg func >=20 > Lua 5.1 interprets ... in the vararg functions like additional local > argument, unlike LuaJIT does. All extra arguments is set into `arg` > variable. >=20 > 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. >=20 > Closes tarantool/tarantool#5712 > Part of tarantool/tarantool#5845 > Part of tarantool/tarantool#4473 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 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 =3D nil >=20 > -- 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. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 >=20 > 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. >>=20 >> 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. >>=20 >> 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(-) >>=20 >> 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') >>=20 >> _G.arg =3D nil >>=20 >> +-- 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) =3D=3D 'table') >> - assert(type(arg.n) =3D=3D 'number') >> + local arg =3D {n =3D select('#', ...), ...} >> for i=3D1,arg.n do assert(a[i]=3D=3Darg[i]) end >> return arg.n >> end >> @@ -17,7 +21,9 @@ function c12 (...) >> return res, 2 >> end >>=20 >> -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 =3D select('#', ...), ...} end >>=20 >> local call =3D function (f, args) return f(unpack(args, 1, args.n)) = end >>=20 >> @@ -42,7 +48,9 @@ a =3D call(print, {'+'}) >> assert(a =3D=3D nil) >>=20 >> local t =3D {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 =3D {...}; return self[...]+#arg end >> assert(t:f(1,4) =3D=3D 3 and t:f(2) =3D=3D 11) >> print('+') >>=20 >> --=20 >> 2.31.0 >>=20 >=20 > --=20 > Best regards, > Sergey Kaplun