PerlPowerTools
view release on metacpan or search on metacpan
use strict;
use warnings;
use Test::More;
use File::Temp;
my $class = require './bin/rm';
is( $class, 'PerlPowerTools::rm' );
my $dir = File::Temp::tempdir( CLEANUP => 1 );
chdir $dir or BAIL_OUT( "Could not change to $dir: $!" );
my $EXIT;
BEGIN {
*CORE::GLOBAL::exit = sub { $EXIT = $_[0] };
}
# These are the elements in each row of the table
my $n; BEGIN { $n = 0 }
use constant FILES => $n++;
use constant OPTIONS => $n++;
use constant ARGS => $n++;
use constant EXIT => $n++;
use constant REMAINS => $n++;
use constant WARNINGS => $n++;
use constant LABEL => $n++;
unlink 't/x/y/bn/6/7/8/goo/txt/$$';
my $no_such_error = "$!"; # No such file
#diag( "Missing file error text is <$no_such_error>" );
my @table = (
[
{},
[qw(-f)],
[qw(foo bar)],
0,
[qw()],
[],
"files don't exist, with -f"
],
[
{},
[],
[qw(foo bar)],
1,
[qw()],
[
qr/cannot remove 'foo': \Q$no_such_error\E/,
qr/cannot remove 'bar': \Q$no_such_error\E/,
],
"files don't exist"
],
[
{
foo => { mode => 0755, type => 'file' },
bar => { mode => 0444, type => 'file' },
},
[],
[qw(foo bar)],
0,
[qw()],
[],
"foo and bar"
],
[
( run in 2.050 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )