]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/*.t: localize $SIG{__WARN__} changes
authorEric Wong <e@yhbt.net>
Sat, 11 Apr 2020 10:53:29 +0000 (10:53 +0000)
committerEric Wong <e@yhbt.net>
Wed, 15 Apr 2020 10:16:05 +0000 (10:16 +0000)
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
t/nntpd.t
t/watch_filter_rubylang.t

index dbcb275b397d470fa9cfdbc362d6d89fde658f8a..6f288b7ebbfb4075eb51cf77853a01791e18e104 100644 (file)
@@ -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";
index 43b14d66389ab6544a38b22d453f33e7295f00f7..826e3f3da27c297a8c490593998045304f0009b6 100644 (file)
--- 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');
index b4540660a79135659821c34276978d9427271b69..09217d94fcfa368e1215ec0a53ad252d5f0cc440 100644 (file)
@@ -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";