summaryrefslogtreecommitdiff
path: root/t/write_file_win32.t
diff options
context:
space:
mode:
Diffstat (limited to 't/write_file_win32.t')
-rw-r--r--t/write_file_win32.t29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/write_file_win32.t b/t/write_file_win32.t
new file mode 100644
index 0000000..1e42456
--- /dev/null
+++ b/t/write_file_win32.t
@@ -0,0 +1,29 @@
+use strict;
+use File::Slurp ;
+
+use Test::More tests => 1;
+
+BEGIN { $^W = 1 }
+
+sub simple_write_file {
+ open FH, ">$_[0]" or die "Couldn't open $_[0] for write: $!";
+ print FH $_[1];
+ close FH ;
+}
+
+sub newline_size {
+ my ($code) = @_;
+
+ my $file = __FILE__ . '.tmp';
+
+ local $\ = '';
+ $code->($file, "\n" x 3);
+
+ my $size = -s $file;
+
+ unlink $file;
+
+ return $size;
+}
+
+is(newline_size(\&write_file), newline_size(\&simple_write_file), 'newline');