diff options
author | Gisle Aas <gisle@aas.no> | 1998-07-06 23:41:14 +0200 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-07 21:36:29 +0000 |
commit | 4b154ab5f602806ac0f12a58e6d35daf8689fea5 (patch) | |
tree | a89be12f160e04ec339225cc77f3f2e8afa08ef9 /t/op/avhv.t | |
parent | 51301382055ed3f3276ad3e2c544fb9e477a270e (diff) | |
download | perl-4b154ab5f602806ac0f12a58e6d35daf8689fea5.tar.gz |
Evaluation of AVHVs in scalar context
Message-ID: <m33ecedaxx.fsf@furu.g.aas.no>
p4raw-id: //depot/perl@1358
Diffstat (limited to 't/op/avhv.t')
-rwxr-xr-x | t/op/avhv.t | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/t/op/avhv.t b/t/op/avhv.t index e01201e845..272d222981 100755 --- a/t/op/avhv.t +++ b/t/op/avhv.t @@ -17,7 +17,7 @@ sub STORESIZE { $#{$_[0]} = $_[1]+1 } package main; -print "1..6\n"; +print "1..10\n"; $sch = { 'abc' => 1, @@ -78,3 +78,21 @@ if ($a->{'abc'} eq 'ABC') {print "ok 5\n";} else {print "not ok 5\n";} my $slice = join('', 'x',@$a{'abc','def'},'x'); print "not " if $slice ne 'xABCx'; print "ok 6\n"; + +# evaluation in scalar context +my $avhv = [{}]; +print "not " if %$avhv; +print "ok 7\n"; + +push @$avhv, "a"; +print "not " if %$avhv; +print "ok 8\n"; + +$avhv = []; +eval { $a = %$avhv }; +print "not " unless $@ and $@ =~ /^Can't coerce array into hash/; +print "ok 9\n"; + +$avhv = [{foo=>1, bar=>2}]; +print "not " unless %$avhv =~ m,^\d+/\d+,; +print "ok 10\n"; |