dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH 1/2] t/psgi_scan_all: reduce use_ok statements
Date: Mon, 15 May 2023 23:17:17 +0000	[thread overview]
Message-ID: <20230515231718.2414428-1-e@80x24.org> (raw)

This can save a handful of cycles to avoid testing things which
are already implicit from other tests.
---
 t/psgi_scan_all.t | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/t/psgi_scan_all.t b/t/psgi_scan_all.t
index 09e8eaf9..ab23128d 100644
--- a/t/psgi_scan_all.t
+++ b/t/psgi_scan_all.t
@@ -1,21 +1,19 @@
 #!perl -w
-# Copyright (C) 2019-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-use strict;
-use v5.10.1;
+use v5.12;
 use PublicInbox::TestCommon;
-use PublicInbox::Eml;
-use PublicInbox::Config;
-my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape DBD::SQLite);
-require_git 2.6;
-require_mods(@mods);
-use_ok 'PublicInbox::WWW';
-foreach my $mod (@mods) { use_ok $mod; }
+my @use = qw(HTTP::Request::Common Plack::Test);
+my @req = qw(URI::Escape DBD::SQLite);
+require_git v2.6;
+require_mods(@use, @req, qw(PublicInbox::WWW PublicInbox::Config));
+use_ok($_) for @use;
 my $cfg = '';
 foreach my $i (1..2) {
 	my $ibx = create_inbox "test-$i", version => 2, indexlevel => 'basic',
 	sub {
 		my ($im, $ibx) = @_;
+		require PublicInbox::Eml;
 		$im->add(PublicInbox::Eml->new(<<EOF)) or BAIL_OUT;
 From: a\@example.com
 To: $ibx->{-primary_address}
@@ -27,10 +25,11 @@ hello world
 EOF
 	};
 	my $cfgpfx = "publicinbox.test-$i";
-	$cfg .= "$cfgpfx.address=$ibx->{-primary_address}\n";
-	$cfg .= "$cfgpfx.inboxdir=$ibx->{inboxdir}\n";
-	$cfg .= "$cfgpfx.url=http://example.com/$i\n";
-
+	$cfg .= <<EOM;
+$cfgpfx.address=$ibx->{-primary_address}
+$cfgpfx.inboxdir=$ibx->{inboxdir}
+$cfgpfx.url=http://example.com/$i
+EOM
 }
 my $www = PublicInbox::WWW->new(PublicInbox::Config->new(\$cfg));
 

             reply	other threads:[~2023-05-15 23:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15 23:17 Eric Wong [this message]
2023-05-15 23:17 ` [PATCH 2/2] t/solver_git: drop needless `use' and Plack deps Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230515231718.2414428-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).