diff options
author | Michael G. Schwern <schwern@pobox.com> | 2011-11-15 17:39:07 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-11-17 10:01:34 -0800 |
commit | bbce3ca648eab3f375216d4c9eba05cb6e005d05 (patch) | |
tree | 7ab2097535b9ff42568b0f010c31906bb41542b8 /t/mro | |
parent | b8ab4b0c2ac8ae091a7ed7909f0d9b01ae5717f0 (diff) | |
download | perl-bbce3ca648eab3f375216d4c9eba05cb6e005d05.tar.gz |
Add class_ok() and object_ok() to t/test.pl.
Change every existing instance of isa_ok() to use object_ok(). This is safe because
before this point, t/test.pl's isa_ok() only worked on objects. lib/dbmt_common.pl is
the last hold out because it uses Test::More.
These are like isa_ok() but they also check if it's a class or an object.
This lets the core tests defend against outlandish bugs while allowing
t/test.pl to retain feature parity with Test::More.
Diffstat (limited to 't/mro')
-rw-r--r-- | t/mro/c3_with_overload.t | 4 | ||||
-rw-r--r-- | t/mro/c3_with_overload_utf8.t | 4 | ||||
-rw-r--r-- | t/mro/isa_c3.t | 2 | ||||
-rw-r--r-- | t/mro/isa_c3_utf8.t | 2 | ||||
-rw-r--r-- | t/mro/isa_dfs.t | 2 | ||||
-rw-r--r-- | t/mro/isa_dfs_utf8.t | 2 | ||||
-rw-r--r-- | t/mro/next_edgecases.t | 10 | ||||
-rw-r--r-- | t/mro/next_edgecases_utf8.t | 10 | ||||
-rw-r--r-- | t/mro/overload_c3.t | 4 | ||||
-rw-r--r-- | t/mro/overload_c3_utf8.t | 4 | ||||
-rw-r--r-- | t/mro/overload_dfs.t | 4 | ||||
-rw-r--r-- | t/mro/package_aliases.t | 4 | ||||
-rw-r--r-- | t/mro/package_aliases_utf8.t | 4 |
13 files changed, 28 insertions, 28 deletions
diff --git a/t/mro/c3_with_overload.t b/t/mro/c3_with_overload.t index 498ce2f613..a75c31a8b3 100644 --- a/t/mro/c3_with_overload.t +++ b/t/mro/c3_with_overload.t @@ -29,10 +29,10 @@ require q(./test.pl); plan(tests => 7); } my $x = InheritingFromOverloadedTest->new(); -isa_ok($x, 'InheritingFromOverloadedTest'); +object_ok($x, 'InheritingFromOverloadedTest'); my $y = OverloadingTest->new(); -isa_ok($y, 'OverloadingTest'); +object_ok($y, 'OverloadingTest'); is("$x", 'InheritingFromOverloadedTest stringified', '... got the right value when stringifing'); is("$y", 'OverloadingTest stringified', '... got the right value when stringifing'); diff --git a/t/mro/c3_with_overload_utf8.t b/t/mro/c3_with_overload_utf8.t index 498ce2f613..a75c31a8b3 100644 --- a/t/mro/c3_with_overload_utf8.t +++ b/t/mro/c3_with_overload_utf8.t @@ -29,10 +29,10 @@ require q(./test.pl); plan(tests => 7); } my $x = InheritingFromOverloadedTest->new(); -isa_ok($x, 'InheritingFromOverloadedTest'); +object_ok($x, 'InheritingFromOverloadedTest'); my $y = OverloadingTest->new(); -isa_ok($y, 'OverloadingTest'); +object_ok($y, 'OverloadingTest'); is("$x", 'InheritingFromOverloadedTest stringified', '... got the right value when stringifing'); is("$y", 'OverloadingTest stringified', '... got the right value when stringifing'); diff --git a/t/mro/isa_c3.t b/t/mro/isa_c3.t index 713d10ef3a..dd129cf442 100644 --- a/t/mro/isa_c3.t +++ b/t/mro/isa_c3.t @@ -64,6 +64,6 @@ foreach my $package (qw(klonk urkkk kapow kayo thwacke zzzzzwap whamm)) { is("@{mro::get_linear_isa($package)}", "@$isa", "\@ISA for $package"); foreach my $class ($package, @$isa, 'UNIVERSAL') { - isa_ok($ref, $class, $package); + object_ok($ref, $class, $package); } } diff --git a/t/mro/isa_c3_utf8.t b/t/mro/isa_c3_utf8.t index 0e69e04eba..3e2e7a999c 100644 --- a/t/mro/isa_c3_utf8.t +++ b/t/mro/isa_c3_utf8.t @@ -66,6 +66,6 @@ foreach my $package (qw(kഌoんḰ urḲḵk 캎oẃ к ṭ화ckэ Źzzzዟ is("@{mro::get_linear_isa($package)}", "@$isa", "\@ISA for $package"); foreach my $class ($package, @$isa, 'UNIVERSAL') { - isa_ok($ref, $class, $package); + object_ok($ref, $class, $package); } } diff --git a/t/mro/isa_dfs.t b/t/mro/isa_dfs.t index 889ee6e531..77c122ea74 100644 --- a/t/mro/isa_dfs.t +++ b/t/mro/isa_dfs.t @@ -60,6 +60,6 @@ foreach my $package (qw(klonk urkkk kapow kayo thwacke zzzzzwap whamm)) { is("@{mro::get_linear_isa($package)}", "@$isa", "\@ISA for $package"); foreach my $class ($package, @$isa, 'UNIVERSAL') { - isa_ok($ref, $class, $package); + object_ok($ref, $class, $package); } } diff --git a/t/mro/isa_dfs_utf8.t b/t/mro/isa_dfs_utf8.t index b6608be4c4..1c95eaa58e 100644 --- a/t/mro/isa_dfs_utf8.t +++ b/t/mro/isa_dfs_utf8.t @@ -62,6 +62,6 @@ foreach my $package (qw(kഌoんḰ urḲḵk 캎oẃ к ṭ화ckэ Źzzzዟ is("@{mro::get_linear_isa($package)}", "@$isa", "\@ISA for $package"); foreach my $class ($package, @$isa, 'UNIVERSAL') { - isa_ok($ref, $class, $package); + object_ok($ref, $class, $package); } } diff --git a/t/mro/next_edgecases.t b/t/mro/next_edgecases.t index 7402ec90ad..e177d7098f 100644 --- a/t/mro/next_edgecases.t +++ b/t/mro/next_edgecases.t @@ -21,7 +21,7 @@ plan(tests => 12); # call the submethod in the direct instance my $foo = Foo->new(); - isa_ok($foo, 'Foo'); + object_ok($foo, 'Foo'); can_ok($foo, 'bar'); is($foo->bar(), 'Foo::bar', '... got the right return value'); @@ -37,8 +37,8 @@ plan(tests => 12); } my $bar = Bar->new(); - isa_ok($bar, 'Bar'); - isa_ok($bar, 'Foo'); + object_ok($bar, 'Bar'); + object_ok($bar, 'Foo'); # test it working with with Sub::Name SKIP: { @@ -68,8 +68,8 @@ plan(tests => 12); } my $baz = Baz->new(); - isa_ok($baz, 'Baz'); - isa_ok($baz, 'Foo'); + object_ok($baz, 'Baz'); + object_ok($baz, 'Foo'); { my $m = sub { (shift)->next::method() }; diff --git a/t/mro/next_edgecases_utf8.t b/t/mro/next_edgecases_utf8.t index bd461c777f..ba6ff8b06b 100644 --- a/t/mro/next_edgecases_utf8.t +++ b/t/mro/next_edgecases_utf8.t @@ -24,7 +24,7 @@ plan(tests => 12); # call the submethod in the direct instance my $foo = ᕘ->new(); - isa_ok($foo, 'ᕘ'); + object_ok($foo, 'ᕘ'); can_ok($foo, 'ƚ'); is($foo->ƚ(), 'ᕘ::ƚ', '... got the right return value'); @@ -40,8 +40,8 @@ plan(tests => 12); } my $bar = Baɾ->new(); - isa_ok($bar, 'Baɾ'); - isa_ok($bar, 'ᕘ'); + object_ok($bar, 'Baɾ'); + object_ok($bar, 'ᕘ'); # test it working with with Sub::Name SKIP: { @@ -71,8 +71,8 @@ plan(tests => 12); } my $baz = બʑ->new(); - isa_ok($baz, 'બʑ'); - isa_ok($baz, 'ᕘ'); + object_ok($baz, 'બʑ'); + object_ok($baz, 'ᕘ'); { my $m = sub { (shift)->next::method() }; diff --git a/t/mro/overload_c3.t b/t/mro/overload_c3.t index a62e631af0..db2b1ec660 100644 --- a/t/mro/overload_c3.t +++ b/t/mro/overload_c3.t @@ -35,10 +35,10 @@ require q(./test.pl); plan(tests => 7); } my $x = InheritingFromOverloadedTest->new(); -isa_ok($x, 'InheritingFromOverloadedTest'); +object_ok($x, 'InheritingFromOverloadedTest'); my $y = OverloadingTest->new(); -isa_ok($y, 'OverloadingTest'); +object_ok($y, 'OverloadingTest'); is("$x", 'InheritingFromOverloadedTest stringified', '... got the right value when stringifing'); is("$y", 'OverloadingTest stringified', '... got the right value when stringifing'); diff --git a/t/mro/overload_c3_utf8.t b/t/mro/overload_c3_utf8.t index 5a483ef5c0..bcb9f70c77 100644 --- a/t/mro/overload_c3_utf8.t +++ b/t/mro/overload_c3_utf8.t @@ -38,10 +38,10 @@ require q(./test.pl); plan(tests => 7); } my $x = 읺ҎꀀḮṆᵷꜰ롬ᵕveŔŁoad엗텟ᵵ->ネᚹ(); -isa_ok($x, '읺ҎꀀḮṆᵷꜰ롬ᵕveŔŁoad엗텟ᵵ'); +object_ok($x, '읺ҎꀀḮṆᵷꜰ롬ᵕveŔŁoad엗텟ᵵ'); my $y = Ov에rꪩࡃᛝTeŝṱ->ネᚹ(); -isa_ok($y, 'Ov에rꪩࡃᛝTeŝṱ'); +object_ok($y, 'Ov에rꪩࡃᛝTeŝṱ'); is("$x", '읺ҎꀀḮṆᵷꜰ롬ᵕveŔŁoad엗텟ᵵ stringified', '... got the right value when stringifing'); is("$y", 'Ov에rꪩࡃᛝTeŝṱ stringified', '... got the right value when stringifing'); diff --git a/t/mro/overload_dfs.t b/t/mro/overload_dfs.t index 89f11d0260..5943c855db 100644 --- a/t/mro/overload_dfs.t +++ b/t/mro/overload_dfs.t @@ -35,10 +35,10 @@ require q(./test.pl); plan(tests => 7); } my $x = InheritingFromOverloadedTest->new(); -isa_ok($x, 'InheritingFromOverloadedTest'); +object_ok($x, 'InheritingFromOverloadedTest'); my $y = OverloadingTest->new(); -isa_ok($y, 'OverloadingTest'); +object_ok($y, 'OverloadingTest'); is("$x", 'InheritingFromOverloadedTest stringified', '... got the right value when stringifing'); is("$y", 'OverloadingTest stringified', '... got the right value when stringifing'); diff --git a/t/mro/package_aliases.t b/t/mro/package_aliases.t index b08e8edd2f..3bc3c8fa74 100644 --- a/t/mro/package_aliases.t +++ b/t/mro/package_aliases.t @@ -30,8 +30,8 @@ plan(tests => 52); ok (Old->isa (New::), 'Old inherits from New'); ok (New->isa (Old::), 'New inherits from Old'); -isa_ok (bless ({}, Old::), New::, 'Old object'); -isa_ok (bless ({}, New::), Old::, 'New object'); +object_ok (bless ({}, Old::), New::, 'Old object'); +object_ok (bless ({}, New::), Old::, 'New object'); # Test that replacing a package by assigning to an existing glob diff --git a/t/mro/package_aliases_utf8.t b/t/mro/package_aliases_utf8.t index ae214e5ce5..0106154c43 100644 --- a/t/mro/package_aliases_utf8.t +++ b/t/mro/package_aliases_utf8.t @@ -33,8 +33,8 @@ plan(tests => 52); ok (ऑlㄉ->isa(Neẁ::), 'ऑlㄉ inherits from Neẁ'); ok (Neẁ->isa(ऑlㄉ::), 'Neẁ inherits from ऑlㄉ'); -isa_ok (bless ({}, ऑlㄉ::), Neẁ::, 'ऑlㄉ object'); -isa_ok (bless ({}, Neẁ::), ऑlㄉ::, 'Neẁ object'); +object_ok (bless ({}, ऑlㄉ::), Neẁ::, 'ऑlㄉ object'); +object_ok (bless ({}, Neẁ::), ऑlㄉ::, 'Neẁ object'); # Test that replacing a package by assigning to an existing glob |