File: 06_curly.t

package info (click to toggle)
libfile-remove-perl 1.60-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 240 kB
  • sloc: perl: 836; makefile: 2
file content (48 lines) | stat: -rw-r--r-- 971 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl

# Regression test for rt.cpan.org #30251.

# Test that a directory called '{1234}' is deleted correctly.

use strict;
use warnings;

use Test::More tests => 6;
use File::Spec::Functions ':ALL';
use File::Remove ();

# Create the test directory
my $dir  = '{1234}';
my $path = catdir( 't', '{1234}' );
unless ( -e $path )
{
    mkdir( $path, 0777 );
}

# TEST
ok( -e $path, "Test directory $path exists" );

# Delete the test directory
my @removed = File::Remove::remove( \1, $path );

# TEST
is_deeply( \@removed, [$path], 'remove returns as expected' );

# TEST
ok( !-e $path, "remove deletes the $path directory" );

# Repeat the tests on a dir named {1234} in the root path
unless ( -e $dir )
{
    mkdir( $dir, 0777 );
}

# TEST
ok( -e $dir, "Test directory $dir exists" );
@removed = File::Remove::remove( \1, $dir );

# TEST
is_deeply( \@removed, [$dir], 'remove returns as expected' );

# TEST
ok( !-e $path, "remove delete the $dir directory" );