This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Check that sparse files hold at least a block (bug in eCryptfs: https://bugs.launchpa...
[perl5.git] / t / op / mkdir.t
CommitLineData
491873e5 1#!./perl -w
a687059c 2
5a211162
GS
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
GS
11use File::Path;
12rmtree('blurfl');
13
3458556d
J
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
RGS
18ok(mkdir('blurfl',0777));
19ok(!mkdir('blurfl',0777));
d13bc652 20like($!, qr/cannot move|exist|denied|unknown/i);
1d4be626
RGS
21ok(-d 'blurfl');
22ok(rmdir('blurfl'));
23ok(!rmdir('blurfl'));
d13bc652 24like($!, qr/cannot find|such|exist|not found|not a directory|unknown/i);
1d4be626
RGS
25ok(mkdir('blurfl'));
26ok(rmdir('blurfl'));
27
7b903762
RGS
28# trailing slashes will be removed before the system call to mkdir
29ok(mkdir('blurfl///'));
30ok(-d 'blurfl');
31ok(rmdir('blurfl///'));
32ok(!-d 'blurfl');
491873e5
RGS
33
34# test default argument
35
36$_ = 'blurfl';
37ok(mkdir);
38ok(-d);
39ok(rmdir);
40ok(!-d);
41$_ = 'lfrulb';
42
43{
44 my $_ = 'blurfl';
45 ok(mkdir);
46 ok(-d);
47 ok(-d 'blurfl');
48 ok(!-d 'lfrulb');
49 ok(rmdir);
50}