From: Eric Wong Date: Tue, 14 May 2019 03:32:01 +0000 (+0000) Subject: t/config.t: remove Data::Dumper dependency X-Git-Tag: v1.2.0~281 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=6062a213721155b945d43da33e723fbacbc8d7fe;p=public-inbox.git t/config.t: remove Data::Dumper dependency CentOS-7 needs the perl-Data-Dumper package, and the test is small enough to roll our own escaping, here. --- diff --git a/t/config.t b/t/config.t index ad738bd3..f0c274b9 100644 --- a/t/config.t +++ b/t/config.t @@ -127,10 +127,13 @@ my @invalid = ( ); -require Data::Dumper; +my %X = ("\0" => '\\0', "\b" => '\\b', "\f" => '\\f', "'" => "\\'"); +my $xre = join('|', keys %X); + for my $s (@invalid) { - my $d = Data::Dumper->new([$s])->Terse(1)->Indent(0)->Dump; - ok(!PublicInbox::Config::valid_inbox_name($s), "$d name rejected"); + my $d = $s; + $d =~ s/($xre)/$X{$1}/g; + ok(!PublicInbox::Config::valid_inbox_name($s), "`$d' name rejected"); } # obviously-valid examples @@ -146,8 +149,7 @@ my @valid = qw(a a@example a@example.com); # '!', '$', '=', '+' push @valid, qw[bang! ca$h less< more> 1% (parens) &more eql= +plus], '#hash'; for my $s (@valid) { - my $d = Data::Dumper->new([$s])->Terse(1)->Indent(0)->Dump; - ok(PublicInbox::Config::valid_inbox_name($s), "$d name accepted"); + ok(PublicInbox::Config::valid_inbox_name($s), "`$s' name accepted"); } {