From: Karen Etheridge Date: Fri, 22 Sep 2017 00:50:00 +0000 (-0700) Subject: explicitly test the return value of the false results X-Git-Tag: v1.000007~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b59e55e212865cc799882404afd572cee2dfdc9c;p=p5sagit%2FSafe-Isa.git explicitly test the return value of the false results --- diff --git a/t/safe_isa.t b/t/safe_isa.t index 77b5bc0..287c38e 100644 --- a/t/safe_isa.t +++ b/t/safe_isa.t @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 20; +use Test::More tests => 26; { package Foo; sub new { bless({}, $_[0]) } } { package Bar; our @ISA = qw(Foo); sub bar { 1 } } @@ -27,15 +27,15 @@ use Safe::Isa; ok($foo->$_isa('Foo'), 'foo $_isa Foo'); ok($bar->$_isa('Foo'), 'bar $_isa Foo'); -ok(eval { $blam->$_isa('Foo'); 1 }, 'no boom today'); -ok(eval { $undef->$_isa('Foo'); 1 }, 'nor tomorrow either'); +ok(eval { is($blam->$_isa('Foo'), undef, 'blam isn\'t Foo'); 1 }, 'no boom today'); +ok(eval { is($undef->$_isa('Foo'), undef, 'undef isn\'t Foo either'); 1 }, 'and no boom tomorrow either'); ok(!$foo->$_can('bar'), 'foo !$_can bar'); ok($bar->$_can('bar'), 'bar $_can bar'); -ok(eval { $blam->$_can('bar'); 1 }, 'no boom today'); -ok(eval { $undef->$_can('bar'); 1 }, 'nor tomorrow either'); +ok(eval { is($blam->$_can('bar'), undef, 'blam can\'t bar'); 1 }, 'no boom today'); +ok(eval { is($undef->$_can('bar'), undef, 'undef can\'t bar either'); 1 }, 'and no boom tomorrow either'); ok($foo->$_call_if_object(isa => 'Foo'), 'foo $_call_if_object(isa => Foo)'); ok($bar->$_call_if_object(isa => 'Foo'), 'bar $_call_if_object(isa => Foo)'); -ok(eval { $blam->$_call_if_object(isa => 'Foo'); 1 }, 'no boom today'); -ok(eval { $undef->$_call_if_object(isa => 'Foo'); 1 }, 'nor tomorrow either'); +ok(eval { is($blam->$_call_if_object(isa => 'Foo'), undef, 'blam can\'t call anything'); 1 }, 'no boom today'); +ok(eval { is($undef->$_call_if_object(isa => 'Foo'), undef, 'undef can\'t call anything'); 1 }, 'and no boom tomorrow either');