From: Eric Wong Date: Thu, 27 Mar 2025 23:20:42 +0000 (+0000) Subject: tests: get rid of most Data::Dumper usage X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ea1e151fe1b1f249a2bf685973580938376e3111;p=thirdparty%2Fpublic-inbox.git tests: get rid of most Data::Dumper usage `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. --- diff --git a/t/httpd-corner.t b/t/httpd-corner.t index e653f1e1a..33a6bd88d 100644 --- a/t/httpd-corner.t +++ b/t/httpd-corner.t @@ -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); diff --git a/t/imapd.t b/t/imapd.t index 27c46e540..c86780483 100644 --- a/t/imapd.t +++ b/t/imapd.t @@ -202,7 +202,7 @@ for my $r ('1:*', '1', '*') { is($envelope->{messageid}, '', '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'); diff --git a/t/nntp.t b/t/nntp.t index 42a4ea976..f1801cfe0 100644 --- 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); };