xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/op/mkdir.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateprint "1..13\n";
4*0Sstevel@tonic-gate
5*0Sstevel@tonic-gateBEGIN {
6*0Sstevel@tonic-gate    chdir 't' if -d 't';
7*0Sstevel@tonic-gate    @INC = '../lib';
8*0Sstevel@tonic-gate}
9*0Sstevel@tonic-gate
10*0Sstevel@tonic-gateuse File::Path;
11*0Sstevel@tonic-gatermtree('blurfl');
12*0Sstevel@tonic-gate
13*0Sstevel@tonic-gate# tests 3 and 7 rather naughtily expect English error messages
14*0Sstevel@tonic-gate$ENV{'LC_ALL'} = 'C';
15*0Sstevel@tonic-gate$ENV{LANGUAGE} = 'C'; # GNU locale extension
16*0Sstevel@tonic-gate
17*0Sstevel@tonic-gateprint (mkdir('blurfl',0777) ? "ok 1\n" : "not ok 1\n");
18*0Sstevel@tonic-gateprint (mkdir('blurfl',0777) ? "not ok 2\n" : "ok 2\n");
19*0Sstevel@tonic-gateprint ($! =~ /cannot move|exist|denied/ ? "ok 3\n" : "# $!\nnot ok 3\n");
20*0Sstevel@tonic-gateprint (-d 'blurfl' ? "ok 4\n" : "not ok 4\n");
21*0Sstevel@tonic-gateprint (rmdir('blurfl') ? "ok 5\n" : "not ok 5\n");
22*0Sstevel@tonic-gateprint (rmdir('blurfl') ? "not ok 6\n" : "ok 6\n");
23*0Sstevel@tonic-gateprint ($! =~ /cannot find|such|exist|not found|not a directory/i ? "ok 7\n" : "# $!\nnot ok 7\n");
24*0Sstevel@tonic-gateprint (mkdir('blurfl') ? "ok 8\n" : "not ok 8\n");
25*0Sstevel@tonic-gateprint (rmdir('blurfl') ? "ok 9\n" : "not ok 9\n");
26*0Sstevel@tonic-gate# trailing slashes will be removed before the system call to mkdir
27*0Sstevel@tonic-gate# but we don't care for MacOS ...
28*0Sstevel@tonic-gateif ($^O eq 'MacOS') {
29*0Sstevel@tonic-gate   print "ok $_\n" for 10..13;
30*0Sstevel@tonic-gate} else {
31*0Sstevel@tonic-gate   print (mkdir('blurfl///') ? "ok 10\n" : "not ok 10\n");
32*0Sstevel@tonic-gate   print (-d 'blurfl' ? "ok 11\n" : "not ok 11\n");
33*0Sstevel@tonic-gate   print (rmdir('blurfl///') ? "ok 12\n" : "not ok 12\n");
34*0Sstevel@tonic-gate   print (!-d 'blurfl' ? "ok 13\n" : "not ok 13\n");
35*0Sstevel@tonic-gate}
36