user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH 3/4] t/*.t: localize $SIG{__WARN__} changes
Date: Sat, 11 Apr 2020 10:53:29 +0000	[thread overview]
Message-ID: <20200411105330.19544-4-e@yhbt.net> (raw)
In-Reply-To: <20200411105330.19544-1-e@yhbt.net>

We don't want to propagate %SIG changes to other tests when
running multiple tests within the same process via t/run.perl.
---
 t/mda_filter_rubylang.t   | 2 +-
 t/nntpd.t                 | 2 +-
 t/watch_filter_rubylang.t | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/mda_filter_rubylang.t b/t/mda_filter_rubylang.t
index dbcb275b..6f288b7e 100644
--- a/t/mda_filter_rubylang.t
+++ b/t/mda_filter_rubylang.t
@@ -18,7 +18,7 @@ is(system(@cfg, 'publicinboxmda.spamcheck', 'none'), 0);
 
 for my $v (qw(V1 V2)) {
 	my @warn;
-	$SIG{__WARN__} = sub { push @warn, @_ };
+	local $SIG{__WARN__} = sub { push @warn, @_ };
 	my $cfgpfx = "publicinbox.$v";
 	my $inboxdir = "$tmpdir/$v";
 	my $addr = "test-$v\@example.com";
diff --git a/t/nntpd.t b/t/nntpd.t
index 43b14d66..826e3f3d 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -268,7 +268,7 @@ Date: Fri, 02 Oct 1993 00:00:00 +0000
 			$for_leafnode->header_set('Message-ID', @mids);
 			$for_leafnode->body_set('not-a-dupe');
 			my $warn = '';
-			$SIG{__WARN__} = sub { $warn .= join('', @_) };
+			local $SIG{__WARN__} = sub { $warn .= join('', @_) };
 			$im->add($for_leafnode);
 			$im->done;
 			like($warn, qr/reused/, 'warned for reused MID');
diff --git a/t/watch_filter_rubylang.t b/t/watch_filter_rubylang.t
index b4540660..09217d94 100644
--- a/t/watch_filter_rubylang.t
+++ b/t/watch_filter_rubylang.t
@@ -24,7 +24,7 @@ SKIP: {
 
 for my $v (@v) {
 	my @warn;
-	$SIG{__WARN__} = sub { push @warn, @_ };
+	local $SIG{__WARN__} = sub { push @warn, @_ };
 	my $cfgpfx = "publicinbox.$v";
 	my $inboxdir = "$tmpdir/$v";
 	my $maildir = "$tmpdir/md-$v";

  parent reply	other threads:[~2020-04-11 10:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-11 10:53 [PATCH 0/4] FreeBSD and test fixes Eric Wong
2020-04-11 10:53 ` [PATCH 1/4] testcommon: DESTROY: wait for killed daemon Eric Wong
2020-04-11 10:53 ` [PATCH 2/4] dskqxs: ignore EV_SET errors on EVFILT_WRITE Eric Wong
2020-04-11 10:53 ` Eric Wong [this message]
2020-04-11 10:53 ` [PATCH 4/4] t/httpd-corner.t: relax read-after-failed-write handling 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

  List information: http://public-inbox.org/README

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

  git send-email \
    --in-reply-to=20200411105330.19544-4-e@yhbt.net \
    --to=e@yhbt.net \
    --cc=meta@public-inbox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).