2c4023ea2cc373714a9a78209c5e5e47a70cb940
[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 my $fh, '>', $_[0] or die "Couldn't open $_[0] for write: $!";
10     print $fh $_[1];
11 }
12
13 sub newline_size {
14     my ($code) = @_;
15
16     my $file = __FILE__ . '.tmp';
17
18     local $\ = '';
19     $code->($file, "\n" x 3);
20
21     my $size = -s $file;
22
23     unlink $file;
24
25     return $size;
26 }
27
28 is(newline_size(\&write_file), newline_size(\&simple_write_file), 'newline');