This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate perlhist entries for 5.8.6 and its perldelta to blead
[perl5.git] / t / op / mkdir.t
... / ...
CommitLineData
1#!./perl
2
3print "1..13\n";
4
5BEGIN {
6 chdir 't' if -d 't';
7 @INC = '../lib';
8}
9
10use File::Path;
11rmtree('blurfl');
12
13# tests 3 and 7 rather naughtily expect English error messages
14$ENV{'LC_ALL'} = 'C';
15$ENV{LANGUAGE} = 'C'; # GNU locale extension
16
17print (mkdir('blurfl',0777) ? "ok 1\n" : "not ok 1\n");
18print (mkdir('blurfl',0777) ? "not ok 2\n" : "ok 2\n");
19print ($! =~ /cannot move|exist|denied/ ? "ok 3\n" : "# $!\nnot ok 3\n");
20print (-d 'blurfl' ? "ok 4\n" : "not ok 4\n");
21print (rmdir('blurfl') ? "ok 5\n" : "not ok 5\n");
22print (rmdir('blurfl') ? "not ok 6\n" : "ok 6\n");
23print ($! =~ /cannot find|such|exist|not found|not a directory/i ? "ok 7\n" : "# $!\nnot ok 7\n");
24print (mkdir('blurfl') ? "ok 8\n" : "not ok 8\n");
25print (rmdir('blurfl') ? "ok 9\n" : "not ok 9\n");
26# trailing slashes will be removed before the system call to mkdir
27# but we don't care for MacOS ...
28if ($^O eq 'MacOS') {
29 print "ok $_\n" for 10..13;
30} else {
31 print (mkdir('blurfl///') ? "ok 10\n" : "not ok 10\n");
32 print (-d 'blurfl' ? "ok 11\n" : "not ok 11\n");
33 print (rmdir('blurfl///') ? "ok 12\n" : "not ok 12\n");
34 print (!-d 'blurfl' ? "ok 13\n" : "not ok 13\n");
35}