diff options
author | Brian Fraser <fraserbn@gmail.com> | 2011-10-04 14:53:12 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-10-06 13:01:11 -0700 |
commit | 072cb3f51939df5a0454482dcc0e528fbf137880 (patch) | |
tree | 7cc6f50bb4126d4a142850c99636aff341358ad7 /t/op | |
parent | 7d892b8ce4bb8f4d2c7f5b5ea38d53ab12dbdb01 (diff) | |
download | perl-072cb3f51939df5a0454482dcc0e528fbf137880.tar.gz |
Tests for DOES/isa/can with UTF8 and embedded nuls
Diffstat (limited to 't/op')
-rw-r--r-- | t/op/universal.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/t/op/universal.t b/t/op/universal.t index dcef480398..9999ca1971 100644 --- a/t/op/universal.t +++ b/t/op/universal.t @@ -10,7 +10,7 @@ BEGIN { require "./test.pl"; } -plan tests => 125; +plan tests => 129; $a = {}; bless $a, "Bob"; @@ -59,6 +59,8 @@ ok $a->isa("main::Bob"); ok $a->isa("Female"); +ok ! $a->isa("Female\0NOT REALLY!"), "->isa is nul-clean."; + ok $a->isa("Human"); ok ! $a->isa("Male"); @@ -68,6 +70,7 @@ ok ! $a->isa('Programmer'); ok $a->isa("HASH"); ok $a->can("eat"); +ok ! $a->can("eat\0Except not!"), "->can is nul-clean."; ok ! $a->can("sleep"); ok my $ref = $a->can("drink"); # returns a coderef is $a->$ref("tea"), "drinking tea"; # ... which works @@ -220,6 +223,9 @@ ok( Bar->DOES( 'Foo' ), '... even when inherited' ); ok( Baz->DOES( 'Baz' ), '... even without inheriting any other DOES()' ); ok( ! Baz->DOES( 'Foo' ), '... returning true or false appropriately' ); +ok( ! "T"->DOES( "T\0" ), 'DOES() is nul-clean' ); +ok( ! Baz->DOES( "Baz\0Boy howdy" ), 'DOES() is nul-clean' ); + package Pig; package Bodine; Bodine->isa('Pig'); |