diff options
author | Rick Delaney <rick@consumercontact.com> | 2007-10-07 18:37:01 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-10-08 08:43:32 +0000 |
commit | e28bb1d52bee845e0aab3d253cd27698a545c674 (patch) | |
tree | 65ff35fbfbe8432df01a5b04af589d3e519fd842 /lib/overload.t | |
parent | 2685328bf99c9543804a38fe9da569e53dcd123a (diff) | |
download | perl-e28bb1d52bee845e0aab3d253cd27698a545c674.tar.gz |
Re: [perl #46011] [RESOLVED] overload "0+" doesn't handle integer results
Message-ID: <20071008023701.GI29047@bort.ca>
p4raw-id: //depot/perl@32062
Diffstat (limited to 'lib/overload.t')
-rw-r--r-- | lib/overload.t | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/overload.t b/lib/overload.t index 9b1792328b..09809d5ce4 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 => 535; +use Test::More tests => 536; $a = new Oscalar "087"; @@ -1383,6 +1383,8 @@ foreach my $op (qw(<=> == != < <= > >=)) { use overload "0+" => sub { $_[0][0]++; $_[0] }; package numify_other; use overload "0+" => sub { $_[0][0]++; $_[0][1] = bless [], 'numify_int' }; + package numify_by_fallback; + use overload "-" => sub { 1 }, fallback => 1; package main; my $o = bless [], 'numify_int'; @@ -1399,4 +1401,7 @@ foreach my $op (qw(<=> == != < <= > >=)) { is(int($s), 42, 'numifies to numification of other object'); is($s->[0], 1, 'int() numifies once when returning other object'); is($s->[1][0], 1, 'returned object numifies too'); + + my $m = bless $aref, 'numify_by_fallback'; + is(int($m), $num_val, 'numifies to usual reference value'); } |