From 5e2699c2b5cca3757bb76a9a8b263138106bcbdb Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Wed, 20 Jul 2011 23:05:56 -0700 Subject: Tests for overload errors --- lib/overload.t | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'lib/overload.t') 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 -- cgit v1.2.1