This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove workaround for distros needing dot in @INC
[perl5.git] / t / uni / write.t
index 0d5cedc..c099957 100644 (file)
@@ -3,19 +3,11 @@ use strict;
 
 BEGIN {
     chdir 't' if -d 't';
-    @INC = qw(../lib .);
-    require "test.pl";
-    unless (PerlIO::Layer->find('perlio')){
-        print "1..0 # Skip: PerlIO required\n";
-        exit 0;
-    }
-    if (ord("A") == 193) {
-        print "1..0 # Skip: EBCDIC porting needed\n";
-        exit 0;
-    }
+    require './test.pl';
+    skip_all_without_perlio();
 }
 
-plan tests => 6;
+plan tests => 8;
 
 # Some tests for UTF8 and format/write
 
@@ -101,4 +93,31 @@ $ulite1
 $bmulti$blite2
 EOEXPECT
 
-1 while unlink 'Uni_write.tmp';
+{
+    use utf8;
+    use open qw( :utf8 :std );
+
+    local $~ = "놋웇ʱFᚖṀŦ";
+    eval { write };
+    like $@, qr/Undefined format "놋웇ʱFᚖṀŦ/u, 'no such format, with format name in UTF-8.';
+}
+
+{
+
+format OUT =
+
+
+.
+    use utf8;
+    use open qw( :utf8 :std );
+    open OUT, '>', '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 );