diff -r 9416fc33d2a0 -r 1bd03bcf26b4 t/000-module.t --- a/t/000-module.t Tue Aug 02 16:02:54 2011 +0200 +++ b/t/000-module.t Tue Aug 02 17:12:48 2011 +0200 @@ -1,18 +1,22 @@ use strict; use warnings; use Test::More; +use File::Temp; + +my $dir = File::Temp->newdir(); use_ok "Fops"; -my $fops = Fops->new(native => "/tmp"); +my $fops = Fops->new(native => $dir); isa_ok($fops => "Fops"); isa_ok($fops => "Fops::native"); is($fops->type => "native", "type is native"); -foreach (qw(type pwd cd)) { +foreach (qw(type pwd cd stat)) { can_ok $fops => $_; } is($fops->pwd() => "/", "working dir is /"); +is($fops->root() => $dir, "root is $dir"); my @dir = ( "////" => "/", @@ -21,16 +25,27 @@ "././/./." => "/", "/a/b/c/d/" => "/a/b/c/d", "/a/b/c/d" => "/a/b/c/d", - ".." => "/a/b/c", + ".." => "/", ); while (@dir) { my $dir = shift @dir; my $pwd = shift @dir; + is(Fops::_path($dir) => $pwd, "canonical $dir"); +} +is(Fops::_path(qw(/a b c)) => "/a/b/c", "canonical /a/b/c"); - ok($fops->cd($dir), "cd $dir"); - is($fops->pwd(), $pwd, "pwd should be $pwd"); -} + +ok($fops->stat("/"), "stat /"); +ok($fops->is_dir("/"), "is dir /"); + +ok($fops->mkpath("a"), "mkpath a"); +ok($fops->is_dir("/a"), "dir /a"); + +ok($fops->mkpath("/x/y/z", "/a/b/c"), "dirs"); +ok($fops->is_dir("/x/y/z"), "dir /x/y/z"); +ok($fops->is_dir("/a/b/c"), "dir /a/b/c"); + done_testing;