From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Alexander Turenko <alexander.turenko@tarantool.org>, Eugine Blikh <bigbes@gmail.com> Cc: tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH] lua: show locals when a tap test fails Date: Fri, 24 Aug 2018 15:51:23 +0300 [thread overview] Message-ID: <d89abe99-0f7d-3019-2b8f-733c8d325855@tarantool.org> (raw) In-Reply-To: <4ed59be1-1b73-423f-f016-d7ecb14ed907@tarantool.org> Sorry, forgot diff. > > My diff (so far it is requested by SOP to paste it here): > diff --git a/src/lua/tap.lua b/src/lua/tap.lua index 9dd531422..625326065 100644 --- a/src/lua/tap.lua +++ b/src/lua/tap.lua @@ -41,21 +41,19 @@ local function locals(test, level) local variables = {} local idx = 1 while true do - local name, value = debug.getlocal(level, idx) - if name ~= nil then - -- compare a table with a tuple raises an error, so we check types - -- first - local eq = type(value) == type(test) and value == test - -- temporary values start with '(' - if not name:startswith('(') and not eq then - variables[name] = value - end - else - break - end - idx = 1 + idx + local name, value = debug.getlocal(level, idx) + if not name then + return variables + end + -- Compare a table with a tuple raises an error, so we + -- check types first. + local is_test = type(value) == type(test) and value == test + -- Temporary values start with '('. + if not name:startswith('(') and not is_test then + variables[name] = value + end + idx = idx + 1 end - return variables end local function diag(test, fmt, ...)
next prev parent reply other threads:[~2018-08-24 12:51 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-08-18 12:36 [tarantool-patches] " Alexander Turenko 2018-08-19 15:35 ` [tarantool-patches] " Alexander Turenko 2018-08-19 15:36 ` Alexander Turenko 2018-08-24 12:25 ` Vladislav Shpilevoy 2018-08-24 12:51 ` Vladislav Shpilevoy [this message] 2018-09-23 17:59 ` Alexander Turenko 2018-09-24 10:47 ` Vladislav Shpilevoy 2018-09-27 0:45 ` Alexander Turenko 2018-10-20 18:36 ` Alexander Turenko
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=d89abe99-0f7d-3019-2b8f-733c8d325855@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=bigbes@gmail.com \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH] lua: show locals when a tap test fails' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox