diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2011-06-07 08:06:16 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2011-06-07 08:06:16 +0000 |
commit | 9d4173f2716c2f9a2d26f8f9ab0f47b351b87de7 (patch) | |
tree | 98ae3fb82096d8bb96686512ada27fa72126b09a /t/perms.t | |
download | File-Slurp-tarball-master.tar.gz |
File-Slurp-9999.19HEADFile-Slurp-9999.19master
Diffstat (limited to 't/perms.t')
-rw-r--r-- | t/perms.t | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/t/perms.t b/t/perms.t new file mode 100644 index 0000000..4cd01fa --- /dev/null +++ b/t/perms.t @@ -0,0 +1,31 @@ +#!/usr/local/bin/perl -w + +use strict ; +use Test::More ; +use File::Slurp ; + +plan skip_all => "meaningless on Win32" if $^O =~ /win32/i ; +plan tests => 2 ; + +my $file = "perms.$$" ; + +my $text = <<END ; +This is a bit of contents +to store in a file. +END + +umask 027 ; + +write_file( $file, $text ) ; +is( getmode( $file ), 0640, 'default perms works' ) ; +unlink $file ; + +write_file( $file, { perms => 0777 }, $text ) ; +is( getmode( $file ), 0750, 'set perms works' ) ; +unlink $file ; + +exit ; + +sub getmode { + return 07777 & (stat $_[0])[2] ; +} |