diff options
author | Eric Wong <e@80x24.org> | 2021-02-10 07:07:47 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-10 19:21:36 +0000 |
commit | 16e016a3dddce6e65c7b69e4f4fd4b7e65b9ccc7 (patch) | |
tree | 149aa2da9d2070d344429ebcf722bfdbc419872e /lib/PublicInbox/TestCommon.pm | |
parent | dcc0322ec3ec03e25a1ff9c3a8dda710712fcc82 (diff) | |
download | public-inbox-16e016a3dddce6e65c7b69e4f4fd4b7e65b9ccc7.tar.gz |
Similar to "lei q", "--local" means only local and "--remote" means remote only. I can't think of a reason to have --no-* variants for these switches. There's also updates to the TestCommon for more common lei cases.
Diffstat (limited to 'lib/PublicInbox/TestCommon.pm')
-rw-r--r-- | lib/PublicInbox/TestCommon.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 64fe0499..f5b3fae4 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -9,12 +9,14 @@ use v5.10.1; use Fcntl qw(FD_CLOEXEC F_SETFD F_GETFD :seek); use POSIX qw(dup2); use IO::Socket::INET; +use File::Spec; our @EXPORT; BEGIN { @EXPORT = qw(tmpdir tcp_server tcp_connect require_git require_mods run_script start_script key2sub xsys xsys_e xqx eml_load tick have_xapian_compact json_utf8 setup_public_inboxes - tcp_host_port test_lei lei $lei $lei_out $lei_err $lei_opt); + tcp_host_port test_lei lei lei_ok + $lei $lei_out $lei_err $lei_opt); require Test::More; my @methods = grep(!/\W/, @Test::More::EXPORT); eval(join('', map { "*$_=\\&Test::More::$_;" } @methods)); @@ -459,6 +461,13 @@ our $lei = sub { sub lei (@) { $lei->(@_) } +sub lei_ok (@) { + my $msg = ref($_[-1]) ? pop(@_) : undef; + # filter out anything that looks like a path name for consistent logs + my @msg = grep(!m!\A/!, @_); + ok($lei->(@_), "lei @msg". ($msg ? " ($$msg)" : '')); +} + sub json_utf8 () { state $x = ref(PublicInbox::Config->json)->new->utf8->canonical; } |