summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorVincent Pit <perl@profvince.com>2008-05-01 14:45:51 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-05-02 11:07:19 +0000
commite67b97bd974194ad616acbb7813c5631aacd6be7 (patch)
treee32b15786d8137b66c0931484bcaab84464780b7 /t
parentaa472d819afa513557c8ae076693d2c753998ed1 (diff)
downloadperl-e67b97bd974194ad616acbb7813c5631aacd6be7.tar.gz
~~ with non-overloaded objects
From: "Vincent Pit" <perl@profvince.com> Message-ID: <63496.92.128.104.139.1209638751.squirrel@92.128.104.139> p4raw-id: //depot/perl@33777
Diffstat (limited to 't')
-rw-r--r--t/op/smobj.t33
1 files changed, 17 insertions, 16 deletions
diff --git a/t/op/smobj.t b/t/op/smobj.t
index 733e31c64e..9d1a0a5dcb 100644
--- a/t/op/smobj.t
+++ b/t/op/smobj.t
@@ -6,11 +6,14 @@ BEGIN {
require './test.pl';
}
-plan tests => 5;
+plan tests => 11;
use strict;
use warnings;
+
+my @tests = ('$obj ~~ "key"', '"key" ~~ $obj', '$obj ~~ $obj');
+
{
package Test::Object::NoOverload;
sub new { bless { key => 1 } }
@@ -19,20 +22,18 @@ use warnings;
{
my $obj = Test::Object::NoOverload->new;
isa_ok($obj, 'Test::Object::NoOverload');
- my $r = eval { ($obj ~~ 'key') };
-
- local $::TODO = 'To be implemented';
-
- ok(
- ! defined $r,
- "we do not smart match against an object's underlying implementation",
- );
-
- like(
- $@,
- qr/overload/,
- "we die when smart matching an obj with no ~~ overload",
- );
+ for (@tests) {
+ my $r = eval;
+ ok(
+ ! defined $r,
+ "we do not smart match against an object's underlying implementation",
+ );
+ like(
+ $@,
+ qr/overload/,
+ "we die when smart matching an obj with no ~~ overload",
+ );
+ }
}
{
@@ -44,5 +45,5 @@ use warnings;
{
my $obj = Test::Object::CopyOverload->new;
isa_ok($obj, 'Test::Object::CopyOverload');
- ok($obj ~~ 'key', 'we are able to make an object ~~ overload');
+ ok(eval, 'we are able to make an object ~~ overload') for @tests;
}