From a09f678d8254064af7ca6dcfb3c3f84b5ae37b51 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 22 Dec 2019 22:17:37 +0000 Subject: testcommon: add require_mods method and use it This cuts down on lines of code in individual test cases and fixes some misnamed error messages by using "$0" consistently. This will also provide us with a method of swapping out dependencies which provide equivalent functionality (e.g "Xapian" SWIG can replace "Search::Xapian" XS bindings). --- t/search-thr-index.t | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 't/search-thr-index.t') diff --git a/t/search-thr-index.t b/t/search-thr-index.t index 47454fe7..4750503c 100644 --- a/t/search-thr-index.t +++ b/t/search-thr-index.t @@ -4,16 +4,12 @@ use strict; use warnings; use bytes (); # only for bytes::length use Test::More; +use PublicInbox::TestCommon; use PublicInbox::MID qw(mids); use Email::MIME; -my @mods = qw(DBI DBD::SQLite Search::Xapian); -foreach my $mod (@mods) { - eval "require $mod"; - plan skip_all => "missing $mod for $0" if $@; -} +require_mods(qw(DBD::SQLite Search::Xapian)); require PublicInbox::SearchIdx; require PublicInbox::Inbox; -use PublicInbox::TestCommon; my ($tmpdir, $for_destroy) = tmpdir(); my $git_dir = "$tmpdir/a.git"; -- cgit v1.2.3-24-ge0c7