Michael Schroeder's fix for re-try if stdio ops after
[p5sagit/p5-mst-13.2.git] / lib / charnames.t
index 8472abf..97663a7 100644 (file)
@@ -6,13 +6,14 @@ BEGIN {
     unless(grep /blib/, @INC) {
        chdir 't' if -d 't';
        @INC = '../lib';
+       require './test.pl';
     }
     $SIG{__WARN__} = sub { push @WARN, @_ };
 }
 
 $| = 1;
 
-print "1..69\n";
+print "1..73\n";
 
 use charnames ':full';
 
@@ -95,7 +96,7 @@ sub to_bytes {
 {
    use charnames qw(:full);
    use utf8;
-   
+
     my $x = "\x{221b}";
     my $named = "\N{CUBE ROOT}";
 
@@ -119,7 +120,7 @@ sub to_bytes {
 }
 
 {
-  # 20001114.001       
+  # 20001114.001
 
   no utf8; # naked Latin-1
 
@@ -292,11 +293,9 @@ for (@prgs) {
        print $ali $fil;
        close $ali or die "Could not close $alifile: $!";
        }
-    my $res =
-       $^O eq "MSWin32" ? `.\\perl -I../lib $switch $tmpfile 2>&1` :
-       $^O eq "NetWare" ? `perl    -I../lib $switch $tmpfile 2>&1` :
-       $^O eq "MacOS"   ? `$^X     -I::lib -MMac::err=unix $switch $tmpfile` :
-                          `./perl -I. -I../lib $switch $tmpfile 2>&1`;
+    my $res = runperl( switches => $switch, 
+                       progfile => $tmpfile,
+                       stderr => 1 );
     my $status = $?;
     $res =~ s/[\r\n]+$//;
     $res =~ s/tmp\d+/-/g;                      # fake $prog from STDIN
@@ -328,17 +327,29 @@ for (@prgs) {
     }
 
 __END__
+# unsupported pragma
+use charnames ":scoobydoo";
+"Here: \N{e_ACUTE}!\n";
+EXPECT
+unsupported special ':scoobydoo' in charnames at
+########
 # wrong type of alias (missing colon)
 use charnames "alias";
 "Here: \N{e_ACUTE}!\n";
 EXPECT
-Unknown charname 'e_ACUTE' at 
+Unknown charname 'e_ACUTE' at
 ########
 # alias without an argument
 use charnames ":alias";
 "Here: \N{e_ACUTE}!\n";
 EXPECT
-Unknown charname 'e_ACUTE' at 
+:alias needs an argument in charnames at
+########
+# reversed sequence
+use charnames ":alias" => ":full";
+"Here: \N{e_ACUTE}!\n";
+EXPECT
+:alias cannot use existing pragma :full \(reversed order\?\) at
 ########
 # alias with hashref but no :full
 use charnames ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" };
@@ -374,7 +385,7 @@ $
 use charnames ":short", ":alias" => "e_ACUTE";
 "Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
 EXPECT
-Odd number of elements in anonymous hash at
+unicore/e_ACUTE_alias.pl cannot be used as alias file for charnames at
 ########
 # alias with arrayref
 use charnames ":short", ":alias" => [ e_ACUTE => "LATIN:e WITH ACUTE" ];
@@ -437,7 +448,19 @@ Unknown charname 'LATIN:e WITH ACUTE' at
 use charnames ":full", ":alias" => "xyzzy";
 "Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
 EXPECT
-Odd number of elements in anonymous hash at
+unicore/xyzzy_alias.pl cannot be used as alias file for charnames at
+########
+# alias with bad file name
+use charnames ":full", ":alias" => "xy 7-";
+"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
+EXPECT
+Charnames alias files can only have identifier characters at
+########
+# alias with non_absolute (existing) file name (which it should /not/ use)
+use charnames ":full", ":alias" => "perl";
+"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
+EXPECT
+unicore/perl_alias.pl cannot be used as alias file for charnames at
 ########
 # alias with bad file
 use charnames ":full", ":alias" => "xyzzy";
@@ -446,7 +469,7 @@ FILE
 #!perl
 0;
 EXPECT
-Odd number of elements in anonymous hash at
+unicore/xyzzy_alias.pl did not return a \(valid\) list of alias pairs at
 ########
 # alias with file with empty list
 use charnames ":full", ":alias" => "xyzzy";