File: 021_list_dir_regression.t

package info (click to toggle)
libfile-util-perl 4.201720-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 840 kB
  • sloc: perl: 4,353; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 898 bytes parent folder | download | duplicates (3)
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

use strict;
use warnings;

# the original intent of this test was to isolate and test solely the
# list_dir method, but it became immediatley apparent that you can't
# very well test list_dir() unless you have a good directory tree first;
# this led to the combining of the make_dir and list_dir testing routines

use Test::More tests => 2;
use Test::NoWarnings;

use File::Temp qw( tempdir );

use lib './lib';
use File::Util qw( SL NL OS );

# one recognized instantiation setting
my $ftl = File::Util->new( );

my $tempdir     = tempdir( CLEANUP => 1 );
my $testbed     = $tempdir . SL . $$ . SL . time;
my @test_dirs   = qw/ Fin Rey Kylo Poe /;

for my $tdir ( @test_dirs )
{
   $ftl->make_dir( $testbed . SL . $tdir )
}

is_deeply
(
   [ sort $ftl->list_dir( $testbed ) ],
   [ sort qw( . .. ), @test_dirs  ],
   'regression: plain dir listing with only subdirs present (no files)'
);

exit;