This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get t/uni/cache.t working under minitest
[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
94af9289
NC
11unless (eval {
12 require File::Path;
13 File::Path::rmtree('blurfl');
14 1
15}) {
16 diag("$0 may fail if its temporary directory remains from a previous run");
17 diag("Attempted to load File::Path to delete directory t/blurfl - error was\n$@");
18 diag("\nIf you have problems, please manually delete t/blurfl");
19}
5a211162 20
3458556d
J
21# tests 3 and 7 rather naughtily expect English error messages
22$ENV{'LC_ALL'} = 'C';
b598356e 23$ENV{LANGUAGE} = 'C'; # GNU locale extension
3458556d 24
1d4be626
RGS
25ok(mkdir('blurfl',0777));
26ok(!mkdir('blurfl',0777));
a9e1ff32 27ok($!{EEXIST} || $! =~ /cannot move|exist|denied|unknown/i);
1d4be626
RGS
28ok(-d 'blurfl');
29ok(rmdir('blurfl'));
30ok(!rmdir('blurfl'));
a9e1ff32 31ok($!{ENOENT} || $! =~ /cannot find|such|exist|not found|not a directory|unknown/i);
1d4be626
RGS
32ok(mkdir('blurfl'));
33ok(rmdir('blurfl'));
34
7b903762
RGS
35# trailing slashes will be removed before the system call to mkdir
36ok(mkdir('blurfl///'));
37ok(-d 'blurfl');
38ok(rmdir('blurfl///'));
39ok(!-d 'blurfl');
491873e5
RGS
40
41# test default argument
42
43$_ = 'blurfl';
44ok(mkdir);
45ok(-d);
46ok(rmdir);
47ok(!-d);
48$_ = 'lfrulb';
49
50{
dcd695b6 51 no warnings 'experimental::lexical_topic';
491873e5
RGS
52 my $_ = 'blurfl';
53 ok(mkdir);
54 ok(-d);
55 ok(-d 'blurfl');
56 ok(!-d 'lfrulb');
57 ok(rmdir);
58}