<HTML><BODY><div>Hi, Igor!</div><div>Thanks for the patch!</div><div>LGTM, except for a few nits regarding the commit message.</div><div> </div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;"><div> <blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;"><div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_16774890040921439441_BODY">Sometimes one need to skip all tests in the script. TAP13 protocol</div></div></div></div></blockquote><div>Typo: s/TAP 13/The TAP 13/</div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;"><div><div class="js-helper js-readmsg-msg"><div><div>supports this via the following line:<br>| 1..0 # SKIP <reason><br><br>Within this commit <test:skipall> helper is introduced that yields the<br>aforementined line to the TAP consumer and exits the test script. It's<br>worth to mention, that skipall helper is implemented only for root (i.e.</div></div></div></div></blockquote><div>Typo: s/worth to mention/worth mentioning/</div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;"><div><div class="js-helper js-readmsg-msg"><div><div>test with no parent) tests and subtests are not supported at the moment.<br>The corresponding assertion with FIXME reason is added to <finalize>.</div></div></div></div></blockquote><div>Typo: s/with/with a/</div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;"><div><div class="js-helper js-readmsg-msg"><div><div><br>Signed-off-by: Igor Munkin <<a href="/compose?To=imun@tarantool.org">imun@tarantool.org</a>><br>---<br> test/tarantool-tests/tap.lua | 23 ++++++++++++++++++++---<br> 1 file changed, 20 insertions(+), 3 deletions(-)<br><br>diff --git a/test/tarantool-tests/tap.lua b/test/tarantool-tests/tap.lua<br>index a1f54d20..92d59ce9 100644<br>--- a/test/tarantool-tests/tap.lua<br>+++ b/test/tarantool-tests/tap.lua<br>@@ -7,6 +7,12 @@<br> local ffi = require("ffi")<br> local NULL = ffi.new("void *")<br> <br>+local function finalize(test)<br>+ -- TODO: implement finalization for subtests too.<br>+ assert(test.parent == nil, 'FIXME: There is no way to use finalize subtest')<br>+ os.exit(test:check() and 0 or 1)<br>+end<br>+<br> local function indent(level, size)<br> -- Use the default indent size if none is specified.<br> size = tonumber(size) or 4<br>@@ -90,6 +96,11 @@ local function skip(test, message, extra)<br> ok(test, true, message .. " # skip", extra)<br> end<br> <br>+local function skipall(test, reason)<br>+ test:plan(0, reason)<br>+ finalize(test)<br>+end<br>+<br> local function like(test, got, pattern, message, extra)<br> extra = extra or {}<br> extra.got = got<br>@@ -246,7 +257,7 @@ local function new(parent, name, fun, ...)<br> level = level,<br> total = 0,<br> failed = 0,<br>- planned = 0,<br>+ planned = nil,<br> trace = parent == nil and true or parent.trace,<br> -- Set test.strict = true if test:is, test:isnt and<br> -- test:is_deeply must be compared strictly with nil.<br>@@ -266,9 +277,14 @@ local function new(parent, name, fun, ...)<br> return test:check()<br> end<br> <br>-local function plan(test, planned)<br>+local function plan(test, planned, reason)<br>+ if test.planned then<br>+ -- Use <plan> call location in the error message.<br>+ error("plan called twice", 2)<br>+ end<br> test.planned = planned<br>- io.write(indent(test.level), ("1..%d\n"):format(planned))<br>+ local tail = planned == 0 and (" # SKIP %s"):format(reason) or ""<br>+ io.write(indent(test.level), ("1..%d%s\n"):format(planned, tail))<br> end<br> <br> local function check(test)<br>@@ -313,6 +329,7 @@ test_mt = {<br> ok = ok,<br> fail = fail,<br> skip = skip,<br>+ skipall = skipall,<br> is = is,<br> isnt = isnt,<br> isnil = isnil,<br>--<br>2.30.2</div></div></div></div></blockquote><div><div>--<br>Best regards,</div><div>Maxim Kokryashkin</div></div><div> </div></div></blockquote></BODY></HTML>