diff options
author | Tony Cook <tony@develop-help.com> | 2018-10-22 13:24:48 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2018-10-22 13:33:27 +1100 |
commit | 854affc4344e6f48685cc3050ef600402eb8de60 (patch) | |
tree | a046491d0db927c9871b892d3d1d8a2478aa4b0a | |
parent | c2167943161b3433eff239edc775830289f9936e (diff) | |
download | perl-854affc4344e6f48685cc3050ef600402eb8de60.tar.gz |
(perl #133604) test for binmode removing :utf8
-rw-r--r-- | t/io/crlf.t | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/t/io/crlf.t b/t/io/crlf.t index 7fb4c1e4a8..aa20f0eda9 100644 --- a/t/io/crlf.t +++ b/t/io/crlf.t @@ -18,7 +18,7 @@ my $crcr = uni_to_native("\x0d\x0d"); my $ungetc_count = 8200; # Somewhat over the likely buffer size { - plan(tests => 16 + 2 * $ungetc_count); + plan(tests => 21 + 2 * $ungetc_count); ok(open(FOO,">:crlf",$file)); ok(print FOO 'a'.((('a' x 14).qq{\n}) x 2000) || close(FOO)); ok(open(FOO,"<:crlf",$file)); @@ -87,6 +87,22 @@ my $ungetc_count = 8200; # Somewhat over the likely buffer size unlike($foo, qr/$crcr/); } } + + { + # check binmode removes :utf8 + # 133604 - on Win32 :crlf is the base buffer layer, so + # binmode doesn't remove it, but the binmode handler didn't + # remove :utf8 either + ok(open(my $fh, ">", $file), "open a file"); + ok(binmode($fh, ":utf8"), "add :utf8"); + ok((() = grep($_ eq "utf8", PerlIO::get_layers($fh))), + "check :utf8 set"); + ok(binmode($fh), "remove :utf8"); + local $TODO = "this fails without the fix"; + ok(!(() = grep($_ eq "utf8", PerlIO::get_layers($fh))), + "check :utf8 removed"); + close $fh; + } } sub count_chars { |