5 use constant TMPDIR => "$Bin/mkdir_test_delete_me";
7 # Delete our directory if it's there
10 # See if we can create directories and remove them
11 mkdir TMPDIR or plan skip_all => "Failed to make test directory";
13 # Test the directory was created
14 -d TMPDIR or plan skip_all => "Failed to make test directory";
16 # Try making it a second time (this should fail)
17 if(mkdir TMPDIR) { plan skip_all => "Attempt to remake a directory succeeded";}
19 # See if we can remove the directory
20 rmdir TMPDIR or plan skip_all => "Failed to remove directory";
22 # Check that the directory was removed
23 if(-d TMPDIR) { plan skip_all => "Failed to delete test directory"; }
25 # Try to delete second time
26 if(rmdir TMPDIR) { plan skip_all => "Able to rmdir directory twice"; }
30 # Create a directory (this should succeed)
36 is($@, "", "mkdir returned success");
37 ok(-d TMPDIR, "Successfully created test directory");
39 # Try to create it again (this should fail)
45 ok($@, "Re-creating directory causes failure.");
46 isa_ok($@, "autodie::exception", "... errors are of the correct type");
47 ok($@->matches("mkdir"), "... it's also a mkdir object");
48 ok($@->matches(":filesys"), "... and a filesys object");
50 # Try to delete directory (this should succeed)
56 is($@, "", "rmdir returned success");
57 ok(! -d TMPDIR, "Successfully removed test directory");
59 # Try to delete directory again (this should fail)
65 ok($@, "Re-deleting directory causes failure.");
66 isa_ok($@, "autodie::exception", "... errors are of the correct type");
67 ok($@->matches("rmdir"), "... it's also a rmdir object");
68 ok($@->matches(":filesys"), "... and a filesys object");