| 1 | #!./perl -w |
| 2 | |
| 3 | BEGIN { |
| 4 | chdir 't' if -d 't'; |
| 5 | @INC = '../lib'; |
| 6 | require './test.pl'; |
| 7 | } |
| 8 | |
| 9 | plan tests => 22; |
| 10 | |
| 11 | use File::Path; |
| 12 | rmtree('blurfl'); |
| 13 | |
| 14 | # tests 3 and 7 rather naughtily expect English error messages |
| 15 | $ENV{'LC_ALL'} = 'C'; |
| 16 | $ENV{LANGUAGE} = 'C'; # GNU locale extension |
| 17 | |
| 18 | ok(mkdir('blurfl',0777)); |
| 19 | ok(!mkdir('blurfl',0777)); |
| 20 | like($!, qr/cannot move|exist|denied|unknown/i); |
| 21 | ok(-d 'blurfl'); |
| 22 | ok(rmdir('blurfl')); |
| 23 | ok(!rmdir('blurfl')); |
| 24 | like($!, qr/cannot find|such|exist|not found|not a directory|unknown/i); |
| 25 | ok(mkdir('blurfl')); |
| 26 | ok(rmdir('blurfl')); |
| 27 | |
| 28 | SKIP: { |
| 29 | # trailing slashes will be removed before the system call to mkdir |
| 30 | # but we don't care for MacOS ... |
| 31 | skip("MacOS", 4) if $^O eq 'MacOS'; |
| 32 | ok(mkdir('blurfl///')); |
| 33 | ok(-d 'blurfl'); |
| 34 | ok(rmdir('blurfl///')); |
| 35 | ok(!-d 'blurfl'); |
| 36 | } |
| 37 | |
| 38 | # test default argument |
| 39 | |
| 40 | $_ = 'blurfl'; |
| 41 | ok(mkdir); |
| 42 | ok(-d); |
| 43 | ok(rmdir); |
| 44 | ok(!-d); |
| 45 | $_ = 'lfrulb'; |
| 46 | |
| 47 | { |
| 48 | my $_ = 'blurfl'; |
| 49 | ok(mkdir); |
| 50 | ok(-d); |
| 51 | ok(-d 'blurfl'); |
| 52 | ok(!-d 'lfrulb'); |
| 53 | ok(rmdir); |
| 54 | } |