From: Nicholas Clark Date: Wed, 23 Jun 2004 08:38:47 +0000 (+0000) Subject: Test that [] // 0 is [] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=121d9cecb1c235bcbe2e57c08c68b6c96f24fe54;p=p5sagit%2Fp5-mst-13.2.git Test that [] // 0 is [] p4raw-id: //depot/perl@22977 --- diff --git a/t/op/dor.t b/t/op/dor.t index 67f2b77..8740a5c 100644 --- a/t/op/dor.t +++ b/t/op/dor.t @@ -10,7 +10,7 @@ BEGIN { package main; require './test.pl'; -plan( tests => 33 ); +plan( tests => 35 ); my($x); @@ -23,6 +23,8 @@ is($x // 1, 1, ' // : left-hand operand undef'); $x=''; is($x // 0, '', ' // : left-hand operand defined but empty'); +like([] // 0, qr/^ARRAY/, ' // : left-hand operand a referece'); + $x=1; is(($x err 0), 1, ' err: left-hand operand defined'); @@ -32,16 +34,18 @@ is(($x err 1), 1, ' err: left-hand operand undef'); $x=''; is(($x err 0), '', ' err: left-hand operand defined but empty'); +like(([] err 0), qr/^ARRAY/, ' err: left-hand operand a referece'); + $x=undef; $x //= 1; is($x, 1, ' //=: left-hand operand undefined'); $x //= 0; -is($x, 1, ' //=: left-hand operand defined'); +is($x, 1, '//=: left-hand operand defined'); $x = ''; $x //= 0; -is($x, '', ' //=: left-hand operand defined but empty'); +is($x, '', '//=: left-hand operand defined but empty'); @ARGV = (undef, 0, 3); is(shift // 7, 7, 'shift // ... works');