diff options
author | Ton Hospel <perl5-porters@ton.iguana.be> | 2005-03-21 21:31:37 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-03-21 21:44:37 +0000 |
commit | 18bdf90ade8cd9b8918f6edac90115b5fbbe6fd3 (patch) | |
tree | dfff75a055c095ef8e751e39552786d910320a1e /t | |
parent | cc601c3163078dbee18369839db37a81c9f1d02a (diff) | |
download | perl-18bdf90ade8cd9b8918f6edac90115b5fbbe6fd3.tar.gz |
Re: unpack A strip patch
Message-Id: <d1nefp$lpe$1@post.home.lunix>
p4raw-id: //depot/perl@24060
Diffstat (limited to 't')
-rwxr-xr-x | t/op/pack.t | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/t/op/pack.t b/t/op/pack.t index 3009510a13..08cf811138 100755 --- a/t/op/pack.t +++ b/t/op/pack.t @@ -12,7 +12,7 @@ my $no_endianness = $] > 5.009 ? '' : my $no_signedness = $] > 5.009 ? '' : "Signed/unsigned pack modifiers not available on this perl"; -plan tests => 14621; +plan tests => 14627; use strict; use warnings; @@ -1807,3 +1807,18 @@ is(unpack('c'), 65, "one-arg unpack (change #18751)"); # defaulting to $_ is(pack("Z*/Z", ""), "1\0\0", "pack Z*/Z makes an extended string"); is(pack("Z*/a", ""), "0\0", "pack Z*/a makes an extended string"); } +{ + # unpack("A*", $unicode) strips general unicode spaces + is(unpack("A*", "ab \n\xa0 \0"), "ab \n\xa0", + 'normal A* strip leaves \xa0'); + is(unpack("U0C0A*", "ab \n\xa0 \0"), "ab \n\xa0", + 'normal A* strip leaves \xa0 even if it got upgraded for technical reasons'); + is(unpack("A*", pack("a*(U0U)a*", "ab \n", 0xa0, " \0")), "ab", + 'upgraded strings A* removes \xa0'); + is(unpack("A*", pack("a*(U0UU)a*", "ab \n", 0xa0, 0x1680, " \0")), "ab", + 'upgraded strings A* removes all unicode whitespace'); + is(unpack("A5", pack("a*(U0U)a*", "ab \n", 0x1680, "def", "ab")), "ab", + 'upgraded strings A5 removes all unicode whitespace'); + is(unpack("A*", pack("U", 0x1680)), "", + 'upgraded strings A* with nothing left'); +} |