diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-06-15 20:41:49 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-07-25 23:47:58 -0700 |
commit | c74b32e11eab9b135a69e56025b7a6a7c7514ea8 (patch) | |
tree | b3e4eb30df1d19dead3eacf892416c14168f94ca /lib | |
parent | deea21e77444ba0d84a6ebc9149baf3ed1e29c80 (diff) | |
download | perl-c74b32e11eab9b135a69e56025b7a6a7c7514ea8.tar.gz |
Test readonliness of overload constants
including one to-do test
Diffstat (limited to 'lib')
-rw-r--r-- | lib/overload.t | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/overload.t b/lib/overload.t index 74adae340e..aa99cc298b 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -48,7 +48,7 @@ package main; $| = 1; BEGIN { require './test.pl' } -plan tests => 5191; +plan tests => 5193; use Scalar::Util qw(tainted); @@ -1293,6 +1293,20 @@ foreach my $op (qw(<=> == != < <= > >=)) { } { + # Check readonliness of constants, whether shared hash key + # scalars or no (brought up in bug #109744) + BEGIN { overload::constant integer => sub { "main" }; } + eval { ${\5} = 'whatever' }; + like $@, qr/^Modification of a read-only value attempted at /, + 'constant overloading makes read-only constants'; + BEGIN { overload::constant integer => sub { __PACKAGE__ }; } + eval { ${\5} = 'whatever' }; + local $::TODO = ' '; + like $@, qr/^Modification of a read-only value attempted at /, + '... even with shared hash key scalars'; +} + +{ package Sklorsh; use overload bool => sub { shift->is_cool }; |