diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-09-24 14:20:48 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-10 21:56:33 -0700 |
commit | d637845879a681ae83da2ae1e0be82308365a626 (patch) | |
tree | 13358d3b31459dca29a439691914a0c6e02ada61 | |
parent | 26a50d995a0122ec4aec3392722aa70e74fe54f3 (diff) | |
download | perl-d637845879a681ae83da2ae1e0be82308365a626.tar.gz |
lvref.t: Test ‘Can't modify reference to...’
-rw-r--r-- | t/op/lvref.t | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/t/op/lvref.t b/t/op/lvref.t index 1fe91bd98e..2755b6007b 100644 --- a/t/op/lvref.t +++ b/t/op/lvref.t @@ -4,7 +4,7 @@ BEGIN { set_up_inc("../lib"); } -plan 37; +plan 40; sub on { $::TODO = ' ' } sub off{ $::TODO = '' } @@ -153,7 +153,21 @@ 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'; + +on; +eval '(\do{}) = 42'; +like $@, qr/^Can't modify reference to do block in list assignment at /, + "Can't modify reference to do block in list assignment"; +off; +eval '(\pos) = 42'; +like $@, + qr/^Can't modify reference to match position in list assignment at /, + "Can't modify ref to some scalar-returning op in list assignment"; on; +eval '(\glob) = 42'; +like $@, + qr/^Can't modify reference to glob in list assignment at /, + "Can't modify reference to some list-returning op in list assignment"; # Miscellaneous |