summaryrefslogtreecommitdiff
path: root/lib/overload.t
diff options
context:
space:
mode:
authorMichael Breen <perl@mbreen.com>2009-12-11 17:48:51 +0000
committerRafael Garcia-Suarez <rgs@consttype.org>2009-12-14 15:08:25 +0100
commit2ab54efd6265713df5cd4bd0927024245675c1c2 (patch)
tree211610a2ee4e47471d0a2a8df034aa1ea135042d /lib/overload.t
parent412147f664b7f5805591ad996d7e5a9e70b3d80f (diff)
downloadperl-2ab54efd6265713df5cd4bd0927024245675c1c2.tar.gz
fix bug 67156: overload: nomethod(..., '!') return value inverted
Diffstat (limited to 'lib/overload.t')
-rw-r--r--lib/overload.t19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/overload.t b/lib/overload.t
index d54068eabc..39333cff87 100644
--- a/lib/overload.t
+++ b/lib/overload.t
@@ -47,7 +47,7 @@ sub numify { 0 + "${$_[0]}" } # Not needed, additional overhead
package main;
$| = 1;
-use Test::More tests => 605;
+use Test::More tests => 607;
$a = new Oscalar "087";
@@ -1420,7 +1420,7 @@ foreach my $op (qw(<=> == != < <= > >=)) {
}
{
- # comparison operators with nomethod
+ # comparison operators with nomethod (bug 41546)
my $warning = "";
my $method;
@@ -1467,6 +1467,21 @@ foreach my $op (qw(<=> == != < <= > >=)) {
}
{
+ # nomethod called for '!' after attempted fallback
+ my $nomethod_called = 0;
+
+ package nomethod_not;
+ use overload nomethod => sub { $nomethod_called = 'yes'; };
+
+ package main;
+ my $o = bless [], 'nomethod_not';
+ my $res = ! $o;
+
+ is($nomethod_called, 'yes', "nomethod() is called for '!'");
+ is($res, 'yes', "nomethod(..., '!') return value propagates");
+}
+
+{
# Subtle bug pre 5.10, as a side effect of the overloading flag being
# stored on the reference rather than the referent. Despite the fact that
# objects can only be accessed via references (even internally), the