[Tarantool-patches] [PATCH luajit 4/5] test: introduce test:skiprest TAP helper

Igor Munkin imun at tarantool.org
Mon Feb 27 12:07:22 MSK 2023


Sometimes one need to skip the remaining tests in the script. There is
no special stub in TAP13 protocol for this, but this could be done via
skipping all the remaining planned tests.

Within this commit <test:skiprest> helper is introduced that calls
<test:skip> (planned - total) times and exits the test script. As for
the previous commit it's worth to mention, that skiprest helper is
implemented only for root (i.e. test with no parent) tests and subtests
are not supported at the moment. The corresponding assertion with FIXME
reason can be found in <finalize> routine.

Signed-off-by: Igor Munkin <imun at tarantool.org>
---
 test/tarantool-tests/tap.lua | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/tarantool-tests/tap.lua b/test/tarantool-tests/tap.lua
index 92d59ce9..343f97e3 100644
--- a/test/tarantool-tests/tap.lua
+++ b/test/tarantool-tests/tap.lua
@@ -101,6 +101,13 @@ local function skipall(test, reason)
   finalize(test)
 end
 
+local function skiprest(test, reason)
+  for _ = 1, test.planned - test.total do
+    test:skip(reason)
+  end
+  finalize(test)
+end
+
 local function like(test, got, pattern, message, extra)
   extra = extra or {}
   extra.got = got
@@ -330,6 +337,7 @@ test_mt = {
     fail       = fail,
     skip       = skip,
     skipall    = skipall,
+    skiprest   = skiprest,
     is         = is,
     isnt       = isnt,
     isnil      = isnil,
-- 
2.30.2



More information about the Tarantool-patches mailing list