From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id AA4821F4B7 for ; Tue, 14 May 2019 03:32:03 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/4] t/config.t: remove Data::Dumper dependency Date: Tue, 14 May 2019 03:32:01 +0000 Message-Id: <20190514033203.6160-3-e@80x24.org> In-Reply-To: <20190514033203.6160-1-e@80x24.org> References: <20190514033203.6160-1-e@80x24.org> List-Id: CentOS-7 needs the perl-Data-Dumper package, and the test is small enough to roll our own escaping, here. --- t/config.t | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/t/config.t b/t/config.t index ad738bd..f0c274b 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"); } { -- EW