develooper Front page | perl.perl5.porters | Postings from February 2001

[PATCH: perl@8892] treat unicoding and null bytes in op/append.t

Thread Previous | Thread Next
From:
Peter Prymmer
Date:
February 22, 2001 13:20
Subject:
[PATCH: perl@8892] treat unicoding and null bytes in op/append.t
Message ID:
Pine.OSF.4.10.10102221319460.47500-100000@aspara.forte.com

Hi,

Without the following patch the odd numbered t/op/append.t tests in
the last block fail on attempts to print wide characters in the # test
comments.  For example:

 $ ./perl op/append.t.orig
 Wide character in print at op/append.t.orig line 43.
 1..13
 #1      :abcdef: eq :abcdef:
 ok 1
 #2      :abcdefxyz: eq :abcdefxyz:
 ok 2
 #3      :abcdef: eq :abcdef:
 ok 3
 ok 4
 ok 5
 ok 6

Here is the fix:

--- t/op/append.t.orig	Thu Feb 22 12:52:55 2001
+++ t/op/append.t	Thu Feb 22 13:13:15 2001
@@ -35,22 +35,25 @@
 
 # test that nul bytes get copied
 {
-    my($a, $ab) = ("a", "a\000b");
+# Character 'b' occurs at codepoint 130 decimal or \202 octal
+# under an EBCDIC coded character set.
+#    my($a, $ab) = ("a", "a\000b");
+    my($a, $ab) = ("\141", "\141\000\142");
     my($u, $ub) = map pack("U0a*", $_), $a, $ab;
     my $t1 = $a; $t1 .= $ab;
-    print $t1 =~ /b/ ? "ok 6\n" : "not ok 6\t# $t1\n";
+    print $t1 =~ /\142/ ? "ok 6\n" : "not ok 6\t# $t1\n";
     my $t2 = $a; $t2 .= $ub;
-    print $t2 =~ /b/ ? "ok 7\n" : "not ok 7\t# $t2\n";
+    print $t2 =~ /\142/ ? "ok 7\n" : "not ok 7\t# $t2\n";
     my $t3 = $u; $t3 .= $ab;
-    print $t3 =~ /b/ ? "ok 8\n" : "not ok 8\t# $t3\n";
+    print $t3 =~ /\142/ ? "ok 8\n" : "not ok 8\t# $t3\n";
     my $t4 = $u; $t4 .= $ub;
-    print $t4 =~ /b/ ? "ok 9\n" : "not ok 9\t# $t4\n";
+    print $t4 =~ /\142/ ? "ok 9\n" : "not ok 9\t# $t4\n";
     my $t5 = $a; $t5 = $ab . $t5;
-    print $t5 =~ /b/ ? "ok 10\n" : "not ok 10\t# $t5\n";
+    print $t5 =~ /\142/ ? "ok 10\n" : "not ok 10\t# $t5\n";
     my $t6 = $a; $t6 = $ub . $t6;
-    print $t6 =~ /b/ ? "ok 11\n" : "not ok 11\t# $t6\n";
+    print $t6 =~ /\142/ ? "ok 11\n" : "not ok 11\t# $t6\n";
     my $t7 = $u; $t7 = $ab . $t7;
-    print $t7 =~ /b/ ? "ok 12\n" : "not ok 12\t# $t7\n";
+    print $t7 =~ /\142/ ? "ok 12\n" : "not ok 12\t# $t7\n";
     my $t8 = $u; $t8 = $ub . $t8;
-    print $t8 =~ /b/ ? "ok 13\n" : "not ok 13\t# $t8\n";
+    print $t8 =~ /\142/ ? "ok 13\n" : "not ok 13\t# $t8\n";
 }
End of Patch.

Peter Prymmer



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About