diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-07-20 23:05:56 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-07-20 23:05:56 -0700 |
commit | 5e2699c2b5cca3757bb76a9a8b263138106bcbdb (patch) | |
tree | e054dc88444ff20950670ddee747858edd5fc73c /lib/overload.t | |
parent | cc383182e6b8a4bfe002aad3786c1dc153b8a109 (diff) | |
download | perl-5e2699c2b5cca3757bb76a9a8b263138106bcbdb.tar.gz |
Tests for overload errors
Diffstat (limited to 'lib/overload.t')
-rw-r--r-- | lib/overload.t | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/overload.t b/lib/overload.t index fbf77f0c85..31629c3a8c 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -48,7 +48,7 @@ package main; $| = 1; BEGIN { require './test.pl' } -plan tests => 4980; +plan tests => 4982; use Scalar::Util qw(tainted); @@ -2168,5 +2168,23 @@ fresh_perl_is is ($a[2], 12, 'Iter1: a[2] concat'); } +# Some tests for error messages +{ + package Justus; + use overload '+' => 'justice'; + eval {bless[]}; + ::like $@, qr/^Can't resolve method "justice" overloading "\+" in p(?x: + )ackage "overload" at /, + 'Error message when explicitly named overload method does not exist'; + + package JustUs; + our @ISA = 'JustYou'; + package JustYou { use overload '+' => 'injustice'; } + "JustUs"->${\"(+"}; + eval {bless []}; + ::like $@, qr/^Stub found while resolving method "\?{3}" overloadin(?x: + )g "\+" in package "overload" at /, + 'Error message when sub stub is encountered'; +} # EOF |