| 12
 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
 
 | # t/04_tempdir.t
use strict;
use warnings;
use Test::More tests =>  8;
use_ok('File::Save::Home', qw|
    get_home_directory
    make_subhome_temp_directory 
| );
use_ok('File::Spec::Functions', qw| splitdir |);
use_ok('Cwd');
my ($cwd, $homedir);
$cwd = cwd();
ok($homedir = get_home_directory(), 'home directory is defined');
ok(chdir $homedir, "able to change to $homedir");
opendir my $DIRH, $homedir or die "Unable to open $homedir for reading: $!";
my %subdirs =  map {$_, 1} 
            grep { -d $_ and ! ($_ eq '.' or $_ eq '..') } 
            readdir($DIRH);
closedir $DIRH or die "Unable to close $homedir after reading: $!";
ok(chdir $cwd, "able to change to $cwd");
my $tmpdir = make_subhome_temp_directory();
ok(  (-d $tmpdir), "$tmpdir exists");
my @homedirels = splitdir($homedir);
my @tmpdirels = splitdir($tmpdir);
shift(@tmpdirels) for @homedirels;
ok(! exists $subdirs{$tmpdirels[0]}, 
    "directory $tmpdirels[0] did not previously exist");
 |