#!./perl -w use strict; BEGIN { require './test.pl'; skip_all("EBCDIC porting needed") if $::IS_EBCDIC; skip_all_without_perlio(); } plan tests => 8; # Some tests for UTF8 and format/write our ($bitem1, $uitem1) = ("\x{ff}", "\x{100}"); our ($bitem2, $uitem2) = ("\x{fe}", "\x{101}"); our ($blite1, $ulite1) = ("\x{fd}", "\x{102}"); our ($blite2, $ulite2) = ("\x{fc}", "\x{103}"); our ($bmulti, $umulti) = ("\x{fb}\n\x{fa}\n\x{f9}\n", "\x{104}\n\x{105}\n\x{106}\n"); sub fmwrtest { no strict 'refs'; my ($out, $format, $expect, $name) = @_; eval "format $out =\n$format.\n"; die $@ if $@; open $out, '>:utf8', 'Uni_write.tmp' or die "Can't create Uni_write.tmp"; write $out; close $out or die "Could not close $out: $!"; open UIN, '<:utf8', 'Uni_write.tmp' or die "Can't open Uni_write.tmp";; my $result = do { local $/; ; }; close UIN; is($result, $expect, $name); } fmwrtest OUT1 => < < < < < <', 'Uni_write2.tmp'; my $oldfh = select OUT; local $^ = "უデfiᕣネḓ_FᚖṀŦɐȾ";#"UNDEFINED_FORMAT"; eval { write }; like $@, qr/Undefined top format "უデfiᕣネḓ_FᚖṀŦɐȾ/u, 'no such top format'; select $oldfh; close OUT; } unlink_all qw( Uni_write.tmp Uni_write2.tmp );