diff options
author | Eric Wong <e@80x24.org> | 2019-05-14 03:32:01 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-05-14 03:43:25 +0000 |
commit | 6062a213721155b945d43da33e723fbacbc8d7fe (patch) | |
tree | 45c4eea9c93e63eae4882ab753ed66e41c172a0c | |
parent | 46835d34029c92a2da886e5d0c17ec83cf86a209 (diff) | |
download | public-inbox-6062a213721155b945d43da33e723fbacbc8d7fe.tar.gz |
CentOS-7 needs the perl-Data-Dumper package, and the test is small enough to roll our own escaping, here.
-rw-r--r-- | t/config.t | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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"); } { |