summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-05-08 22:37:03 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-05-08 22:37:03 +0200
commit6d743019f3ff1c2efcf74a1e4f98ea5bd3b7351a (patch)
tree0789c3863bdd0915e2532954c23eb5a7c886204b /t
parent031a44ed339cfee9d4b2bc19abf15fa19412c9fd (diff)
downloadperl-6d743019f3ff1c2efcf74a1e4f98ea5bd3b7351a.tar.gz
Make ~~ overloading only be invoked on the right argument
Diffstat (limited to 't')
-rw-r--r--t/op/smartmatch.t2
-rw-r--r--t/op/switch.t15
2 files changed, 6 insertions, 11 deletions
diff --git a/t/op/smartmatch.t b/t/op/smartmatch.t
index 3838518eac..75c0ec08e7 100644
--- a/t/op/smartmatch.t
+++ b/t/op/smartmatch.t
@@ -150,7 +150,7 @@ __DATA__
# regular object
@ $obj $obj
-@ $ov_obj $obj TODO
+@ $ov_obj $obj
@ \&fatal $obj
@ \&FALSE $obj
@ \&foo $obj
diff --git a/t/op/switch.t b/t/op/switch.t
index f4cedba209..9ca4f133c2 100644
--- a/t/op/switch.t
+++ b/t/op/switch.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use warnings;
-use Test::More tests => 124;
+use Test::More tests => 118;
# The behaviour of the feature pragma should be tested by lib/switch.t
# using the tests in t/lib/switch/*. This file tests the behaviour of
@@ -772,6 +772,7 @@ SKIP: {
{ package OverloadTest;
use overload '""' => sub{"string value of obj"};
+ use overload 'eq' => sub{"$_[0]" eq "$_[1]"};
use overload "~~" => sub {
my ($self, $other, $reversed) = @_;
@@ -806,11 +807,8 @@ SKIP: {
default {$matched = 0}
}
- is($obj->{called}, 1, "$test: called");
- ok($matched, "$test: matched");
- is($obj->{left}, "string value of obj", "$test: left");
- is($obj->{right}, "other arg", "$test: right");
- ok(!$obj->{reversed}, "$test: not reversed");
+ is($obj->{called}, 0, "$test: called");
+ ok(!$matched, "$test: not matched");
}
{
@@ -821,11 +819,8 @@ SKIP: {
when ("other arg") {$matched = 1}
}
- is($obj->{called}, 1, "$test: called");
+ is($obj->{called}, 0, "$test: called");
ok(!$matched, "$test: not matched");
- is($obj->{left}, "string value of obj", "$test: left");
- is($obj->{right}, "other arg", "$test: right");
- ok(!$obj->{reversed}, "$test: not reversed");
}
{