diff options
Diffstat (limited to 't/21-types/HashLike.t')
-rw-r--r-- | t/21-types/HashLike.t | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/t/21-types/HashLike.t b/t/21-types/HashLike.t index 15b8cc60..c0fac67e 100644 --- a/t/21-types/HashLike.t +++ b/t/21-types/HashLike.t @@ -82,6 +82,13 @@ my @tests = ( fail => 'ref to hashref' => do { my $x = {}; \$x }, fail => 'ref to coderef' => do { my $x = sub { 1 }; \$x }, fail => 'ref to blessed hashref' => do { my $x = bless({}, 'SomePkg'); \$x }, + fail => 'object stringifying to ""' => do { package Local::OL::StringEmpty; use overload q[""] => sub { "" }; bless [] }, + fail => 'object stringifying to "1"' => do { package Local::OL::StringOne; use overload q[""] => sub { "1" }; bless [] }, + fail => 'object numifying to 0' => do { package Local::OL::NumZero; use overload q[0+] => sub { 0 }; bless [] }, + fail => 'object numifying to 1' => do { package Local::OL::NumOne; use overload q[0+] => sub { 1 }; bless [] }, + fail => 'object overloading arrayref' => do { package Local::OL::Array; use overload q[@{}] => sub { $_[0]{array} }; bless {array=>[]} }, + pass => 'object overloading hashref' => do { package Local::OL::Hash; use overload q[%{}] => sub { $_[0][0] }; bless [{}] }, + fail => 'object overloading coderef' => do { package Local::OL::Code; use overload q[&{}] => sub { $_[0][0] }; bless [sub { 1 }] }, #TESTS ); |