diff options
Diffstat (limited to 'cpan/Devel-PPPort/t/magic.t')
-rw-r--r-- | cpan/Devel-PPPort/t/magic.t | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/cpan/Devel-PPPort/t/magic.t b/cpan/Devel-PPPort/t/magic.t index 0bfe0535f2..f467613f27 100644 --- a/cpan/Devel-PPPort/t/magic.t +++ b/cpan/Devel-PPPort/t/magic.t @@ -30,9 +30,9 @@ BEGIN { require 'testutil.pl' if $@; } - if (15) { + if (23) { load(); - plan(tests => 15); + plan(tests => 23); } } @@ -48,6 +48,30 @@ bootstrap Devel::PPPort; package main; +# Find proper magic +ok(my $obj1 = Devel::PPPort->new_with_mg()); +ok(Devel::PPPort::as_string($obj1), 'hello'); + +# Find with no magic +my $obj = bless {}, 'Fake::Class'; +ok(Devel::PPPort::as_string($obj), "Sorry, your princess is in another castle."); + +# Find with other magic (not the magic we are looking for) +ok($obj = Devel::PPPort->new_with_other_mg()); +ok(Devel::PPPort::as_string($obj), "Sorry, your princess is in another castle."); + +# Okay, attempt to remove magic that isn't there +Devel::PPPort::remove_other_magic($obj1); +ok(Devel::PPPort::as_string($obj1), 'hello'); + +# Remove magic that IS there +Devel::PPPort::remove_null_magic($obj1); +ok(Devel::PPPort::as_string($obj1), "Sorry, your princess is in another castle."); + +# Removing when no magic present +Devel::PPPort::remove_null_magic($obj1); +ok(Devel::PPPort::as_string($obj1), "Sorry, your princess is in another castle."); + use Tie::Hash; my %h; tie %h, 'Tie::StdHash'; |