]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
tests: get rid of most Data::Dumper usage
authorEric Wong <e@80x24.org>
Thu, 27 Mar 2025 23:20:42 +0000 (23:20 +0000)
committerEric Wong <e@80x24.org>
Sun, 30 Mar 2025 18:19:29 +0000 (18:19 +0000)
`explain' from Test::More already uses Data::Dumper, so
it's unnecessary to set it up and call it ourselves.
This saves a bunch of wonky code in t/nntp.t, as well.

t/httpd-corner.t
t/imapd.t
t/nntp.t

index e653f1e1aecebd3cc6670d3b0eca72917df2cb51..33a6bd88d14dd448af5e6c91c87ca931fcbe7fd4 100644 (file)
@@ -221,9 +221,8 @@ sub check_400 {
        # and intentionally bad commas (e.g. "Content-Length: 3, 3")
        if (0) {
                require Plack::HTTPParser; # XS or pure Perl
-               require Data::Dumper;
                Plack::HTTPParser::parse_http_request($req, my $env = {});
-               diag Data::Dumper::Dumper($env); # "Content-Length: 3, 3"
+               diag explain($env); # "Content-Length: 3, 3"
        }
        my $conn = conn_for($sock, '1.1 Content-Length dupe');
        $conn->write($req);
index 27c46e5401195cbbb5ccb706f385fdfe2f3d7a51..c8678048382f357c80d46d53a97804d83a828638 100644 (file)
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -202,7 +202,7 @@ for my $r ('1:*', '1', '*') {
        is($envelope->{messageid}, '<testmessage@example.com>', 'messageid');
        is(scalar @{$envelope->{to}}, 1, 'one {to} header');
        # *sigh* too much to verify...
-       #use Data::Dumper; diag Dumper($envelope);
+       # explain($envelope);
 
        $ret = $mic->fetch_hash($r, 'FLAGS') or BAIL_OUT "FETCH $@";
        is_deeply($ret->{1}->{FLAGS}, '', 'no flags');
index 42a4ea97697970e4576c9bb36e236c855e7369fd..f1801cfe0f2322b5865a7af028fb5d5e2c95c9a5 100644 (file)
--- a/t/nntp.t
+++ b/t/nntp.t
@@ -7,22 +7,13 @@ require_mods(qw(DBD::SQLite));
 use_ok 'PublicInbox::NNTP';
 use PublicInbox::Config;
 use POSIX qw(strftime);
-use Data::Dumper;
 
 {
-       my $quote_str = sub {
-               my ($orig) = @_;
-               my (undef, $s) = split(/ = /, Dumper($orig), 2);
-               $s // diag explain(['$s undefined, $orig = ', $orig]);
-               $s =~ s/;\n//;
-               $s;
-       };
-
        my $wm_prepare = sub {
                my ($wm) = @_;
                my $orig = qq{'$wm'};
                PublicInbox::NNTP::wildmat2re($_[0]);
-               my $new = $quote_str->($_[0]);
+               my $new = explain($_[0]);
                ($orig, $new);
        };