summaryrefslogtreecommitdiff
path: root/t/21-types/RoleName.t
diff options
context:
space:
mode:
authorToby Inkster <mail@tobyinkster.co.uk>2019-11-23 14:51:23 +0000
committerToby Inkster <mail@tobyinkster.co.uk>2019-11-23 14:51:23 +0000
commit458070b5b019bb5bc880e8c94ba3cd1e23fef4ad (patch)
treee40bdeefd671d2a237db0106911388bc671e08b4 /t/21-types/RoleName.t
parent4aa3817230be874012865257eb660699c1256483 (diff)
add a bunch more standard tests for each type, all involving overloaded objects
Diffstat (limited to 't/21-types/RoleName.t')
-rw-r--r--t/21-types/RoleName.t7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/21-types/RoleName.t b/t/21-types/RoleName.t
index 61c7997b..78f0128a 100644
--- a/t/21-types/RoleName.t
+++ b/t/21-types/RoleName.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=>[]} },
+ fail => '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
);