diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-09-28 00:53:19 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-10 21:57:28 -0700 |
commit | 0719038db701ddbd6dd038d7df520bafa71351b9 (patch) | |
tree | 0fe79e43cd764e003d1adf3ca6b77c05c45eeace | |
parent | 3f114923fafe08a32936a624ab87ca92d92a109f (diff) | |
download | perl-0719038db701ddbd6dd038d7df520bafa71351b9.tar.gz |
lvref.t: Test assigning non-array to array
Same with hashes.
-rw-r--r-- | t/op/lvref.t | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/t/op/lvref.t b/t/op/lvref.t index 0a4b988a99..de508ede07 100644 --- a/t/op/lvref.t +++ b/t/op/lvref.t @@ -4,7 +4,7 @@ BEGIN { set_up_inc("../lib"); } -plan 88; +plan 92; sub on { $::TODO = ' ' } sub off{ $::TODO = '' } @@ -280,6 +280,18 @@ like $@, qr/^Assigned value is not a SCALAR reference at/, eval { \$::x = [] }; like $@, qr/^Assigned value is not a SCALAR reference at/, 'assigning non-scalar ref to package scalar ref'; +eval { my @x; \@x = {} }; +like $@, qr/^Assigned value is not an ARRAY reference at/, + 'assigning non-array ref to array ref'; +eval { \@::x = {} }; +like $@, qr/^Assigned value is not an ARRAY reference at/, + 'assigning non-array ref to package array ref'; +eval { my %x; \%x = [] }; +like $@, qr/^Assigned value is not a HASH reference at/, + 'assigning non-hash ref to hash ref'; +eval { \%::x = [] }; +like $@, qr/^Assigned value is not a HASH reference at/, + 'assigning non-hash ref to package hash ref'; on; eval '(\do{}) = 42'; |