diff options
author | Eric Wong <e@80x24.org> | 2021-03-28 00:17:25 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-03-28 02:43:54 +0000 |
commit | 29792d70a5d8305f68521664a7fa2e0fe54ff291 (patch) | |
tree | 441c0aafeef6cf9639360308371846cdaf003528 /lib/PublicInbox/TestCommon.pm | |
parent | ba6f3d8379fb9ee8d0f18e3e0d6d77386daf79c9 (diff) | |
download | public-inbox-29792d70a5d8305f68521664a7fa2e0fe54ff291.tar.gz |
This makes it easier to manage test dependencies on systems where optional stuff isn't installed. This fixes some lei tests which didn't check for Plack before starting -httpd, and ensures Parse::RecDescent is available for -imapd in case Mail::IMAPClient stops using it.
Diffstat (limited to 'lib/PublicInbox/TestCommon.pm')
-rw-r--r-- | lib/PublicInbox/TestCommon.pm | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 72617a78..d36a63aa 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -107,20 +107,29 @@ sub require_mods { my $maybe = pop @mods if $mods[-1] =~ /\A[0-9]+\z/; my @need; while (my $mod = shift(@mods)) { + if ($mod eq 'lei') { + require_git(2.6, $maybe ? $maybe : ()); + push @mods, qw(DBD::SQLite Search::Xapian); + $mod = 'json'; # fall-through + } if ($mod eq 'json') { - $mod = 'Cpanel::JSON::XS||JSON::MaybeXS||'. - 'JSON||JSON::PP' + $mod = 'Cpanel::JSON::XS||JSON::MaybeXS||JSON||JSON::PP' + } elsif ($mod eq '-httpd') { + push @mods, qw(Plack::Builder Plack::Util); + next; + } elsif ($mod eq '-imapd') { + push @mods, qw(Parse::RecDescent DBD::SQLite + Email::Address::XS||Mail::Address); + next; + } elsif ($mod eq '-nntpd') { + push @mods, qw(DBD::SQLite); + next; } if ($mod eq 'Search::Xapian') { if (eval { require PublicInbox::Search } && PublicInbox::Search::load_xapian()) { next; } - } elsif ($mod eq 'Search::Xapian::WritableDatabase') { - if (eval { require PublicInbox::SearchIdx } && - PublicInbox::SearchIdx::load_xapian_writable()){ - next; - } } elsif (index($mod, '||') >= 0) { # "Foo||Bar" my $ok; for my $m (split(/\Q||\E/, $mod)) { |