changes
[urisagit/Perl-Docs.git] / t / perms.t
CommitLineData
2b56fd3b 1#!/usr/local/bin/perl -w
2
3use strict ;
4use Test::More ;
5use File::Slurp ;
6
12444d55 7plan skip_all => "meaningless on Win32" if $^O =~ /win32/i ;
2b56fd3b 8plan tests => 2 ;
9
10my $file = "perms.$$" ;
11
12my $text = <<END ;
13This is a bit of contents
14to store in a file.
15END
16
17umask 027 ;
18
19write_file( $file, $text ) ;
20is( getmode( $file ), 0640, 'default perms works' ) ;
21unlink $file ;
22
23write_file( $file, { perms => 0777 }, $text ) ;
24is( getmode( $file ), 0750, 'set perms works' ) ;
25unlink $file ;
26
27exit ;
28
29sub getmode {
30 return 07777 & (stat $_[0])[2] ;
31}