diff options
author | Gisle Aas <gisle@aas.no> | 2005-07-14 19:32:50 -0700 |
---|---|---|
committer | H.Merijn Brand <h.m.brand@xs4all.nl> | 2005-07-16 08:07:44 +0000 |
commit | c4aca7d03737ddcac23de1ad6d597e98be679214 (patch) | |
tree | 0a3a2c3042bba6da8246cf336e1c4d10f6aa61d1 /t/io | |
parent | aec46f14fac1bc74bf8ad4054a6f9674b324f8d2 (diff) | |
download | perl-c4aca7d03737ddcac23de1ad6d597e98be679214.tar.gz |
Re: fchmod, fchown, fchdir
Message-ID: <lrwtnse7nh.fsf@caliper.activestate.com>
+ Schwern's ok -> like changes
p4raw-id: //depot/perl@25157
Diffstat (limited to 't/io')
-rwxr-xr-x | t/io/fs.t | 33 |
1 files changed, 32 insertions, 1 deletions
@@ -47,7 +47,7 @@ $needs_fh_reopen = 1 if (defined &Win32::IsWin95 && Win32::IsWin95()); my $skip_mode_checks = $^O eq 'cygwin' && $ENV{CYGWIN} !~ /ntsec/; -plan tests => 34; +plan tests => 42; if (($^O eq 'MSWin32') || ($^O eq 'NetWare')) { @@ -166,6 +166,37 @@ SKIP: { is($ino, undef, "ino of removed file x should be undef"); } +SKIP: { + skip "no fchmod", 5 unless ($Config{d_fchmod} || "") eq "define"; + ok(open(my $fh, "<", "a"), "open a"); + is(chmod(0, $fh), 1, "fchmod"); + $mode = (stat "a")[2]; + is($mode & 0777, 0, "perm reset"); + is(chmod($newmode, "a"), 1, "fchmod"); + $mode = (stat $fh)[2]; + is($mode & 0777, $newmode, "perm restored"); +} + +SKIP: { + skip "no fchown", 1 unless ($Config{d_fchown} || "") eq "define"; + open(my $fh, "<", "a"); + is(chown(-1, -1, $fh), 1, "fchown"); +} + +SKIP: { + skip "has fchmod", 1 if ($Config{d_fchmod} || "") eq "define"; + open(my $fh, "<", "a"); + eval { chmod(0777, $fh); }; + like($@, qr/^The fchmod function is unimplemented at/, "fchmod is unimplemented"); +} + +SKIP: { + skip "has fchown", 1 if ($Config{d_fchown} || "") eq "define"; + open(my $fh, "<", "a"); + eval { chown(0, 0, $fh); }; + like($@, qr/^The fchown function is unimplemented at/, "fchown is unimplemented"); +} + is(rename('a','b'), 1, "rename a b"); ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, |