Small optimisations, by Brandon Black
[p5sagit/p5-mst-13.2.git] / t / op / mkdir.t
CommitLineData
491873e5 1#!./perl -w
a687059c 2
5a211162 3BEGIN {
4 chdir 't' if -d 't';
20822f61 5 @INC = '../lib';
1d4be626 6 require './test.pl';
1f47e8e2 7}
a687059c 8
491873e5 9plan tests => 22;
1d4be626 10
5a211162 11use File::Path;
12rmtree('blurfl');
13
3458556d 14# tests 3 and 7 rather naughtily expect English error messages
15$ENV{'LC_ALL'} = 'C';
b598356e 16$ENV{LANGUAGE} = 'C'; # GNU locale extension
3458556d 17
1d4be626 18ok(mkdir('blurfl',0777));
19ok(!mkdir('blurfl',0777));
d13bc652 20like($!, qr/cannot move|exist|denied|unknown/i);
1d4be626 21ok(-d 'blurfl');
22ok(rmdir('blurfl'));
23ok(!rmdir('blurfl'));
d13bc652 24like($!, qr/cannot find|such|exist|not found|not a directory|unknown/i);
1d4be626 25ok(mkdir('blurfl'));
26ok(rmdir('blurfl'));
27
28SKIP: {
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');
63c6dcc1 36}
491873e5 37
38# test default argument
39
40$_ = 'blurfl';
41ok(mkdir);
42ok(-d);
43ok(rmdir);
44ok(!-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}