1e424568fbe0eeda40c70b51b4485ba16d20d995
[urisagit/Perl-Docs.git] / t / write_file_win32.t
1 use strict;
2 use File::Slurp ;
3
4 use Test::More tests => 1;
5
6 BEGIN { $^W = 1 }
7
8 sub simple_write_file {
9     open FH, ">$_[0]" or die "Couldn't open $_[0] for write: $!";
10     print FH $_[1];
11     close FH ;
12 }
13
14 sub newline_size {
15     my ($code) = @_;
16
17     my $file = __FILE__ . '.tmp';
18
19     local $\ = '';
20     $code->($file, "\n" x 3);
21
22     my $size = -s $file;
23
24     unlink $file;
25
26     return $size;
27 }
28
29 is(newline_size(\&write_file), newline_size(\&simple_write_file), 'newline');