From: Jarkko Hietaniemi Date: Fri, 19 Oct 2001 23:16:06 +0000 (+0000) Subject: Unpack in scalar context should return the first value X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bf80f5a2c0a23d1b580bf7b35d9ad8d922d88ebd;p=p5sagit%2Fp5-mst-13.2.git Unpack in scalar context should return the first value returned in list context, as pointed out by Ton Hospel in 2001-05-21 (this is how it works already in blead, just adding the test). p4raw-id: //depot/perl@12515 --- diff --git a/t/op/pack.t b/t/op/pack.t index f944aaf..cfb5501 100755 --- a/t/op/pack.t +++ b/t/op/pack.t @@ -1,6 +1,6 @@ #!./perl -w -print "1..611\n"; +print "1..613\n"; BEGIN { chdir 't' if -d 't'; @@ -661,3 +661,13 @@ foreach ( my @u = unpack($t, $p); ok(@u == 2 && $u[0] eq $u && $u[1] eq $v); } + +{ + # 612 + + ok((unpack("w/a*", "\x02abc"))[0] eq "ab"); + + # 613: "w/a*" should be seen as one unit + + ok(scalar unpack("w/a*", "\x02abc") eq "ab"); +}