about summary refs log tree commit homepage
path: root/lib/PublicInbox/TestCommon.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-25 06:20:24 +0200
committerEric Wong <e@80x24.org>2021-03-25 17:59:03 +0000
commitc1b912dea25f48958434f1e85337029b0959fc83 (patch)
tree108147df9e3c723efc906b9afb7a5c2a1f23a54f /lib/PublicInbox/TestCommon.pm
parent64b1ce9f94127fc144d6205bb572fe43b4b552c2 (diff)
downloadpublic-inbox-c1b912dea25f48958434f1e85337029b0959fc83.tar.gz
"lei import" should never be without a {sto}, and *_done should
not be called multiple times, so ensure we can fail if it's
missing.

Update some existing tests to complain loudly by introducing a
handy "xbail" function which wraps "explain" and BAIL_OUT.
BAIL_OUT was painful to type and concatenating the result of
"explain" doesn't work as I thought it would since "explain"
always returns an array, and BAIL_OUT only accepts a single
scalar arg (unlike "die").
Diffstat (limited to 'lib/PublicInbox/TestCommon.pm')
-rw-r--r--lib/PublicInbox/TestCommon.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index ca165a04..72617a78 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -17,7 +17,7 @@ BEGIN {
                 run_script start_script key2sub xsys xsys_e xqx eml_load tick
                 have_xapian_compact json_utf8 setup_public_inboxes create_inbox
                 tcp_host_port test_lei lei lei_ok $lei_out $lei_err $lei_opt
-                test_httpd);
+                test_httpd xbail);
         require Test::More;
         my @methods = grep(!/\W/, @Test::More::EXPORT);
         eval(join('', map { "*$_=\\&Test::More::$_;" } @methods));
@@ -25,6 +25,8 @@ BEGIN {
         push @EXPORT, @methods;
 }
 
+sub xbail (@) { BAIL_OUT join(' ', map { ref ? (explain($_)) : ($_) } @_) }
+
 sub eml_load ($) {
         my ($path, $cb) = @_;
         open(my $fh, '<', $path) or die "open $path: $!";