summaryrefslogtreecommitdiff
path: root/t/mro
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-09-26 16:32:45 +0000
committerNicholas Clark <nick@ccl4.org>2007-09-26 16:32:45 +0000
commit84dccb35f7809a3cd00c6b11d0a9aa40b70e045f (patch)
treeca3fa7a83fc4bb3db2ceeec597b49447e94fb6cf /t/mro
parent1a36314cbeab52a90bc0d56b6f2c61f22e03df5d (diff)
downloadperl-84dccb35f7809a3cd00c6b11d0a9aa40b70e045f.tar.gz
Change 31977 introduced a bug (failing to set the return value of
mro::get_linear_isa() when passed a second parameter). However, there were no tests for this. Fix both. p4raw-id: //depot/perl@31981
Diffstat (limited to 't/mro')
-rw-r--r--t/mro/basic.t21
1 files changed, 16 insertions, 5 deletions
diff --git a/t/mro/basic.t b/t/mro/basic.t
index 695306cf61..a4a61924d2 100644
--- a/t/mro/basic.t
+++ b/t/mro/basic.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-require q(./test.pl); plan(tests => 29);
+require q(./test.pl); plan(tests => 35);
{
package MRO_A;
@@ -20,18 +20,29 @@ require q(./test.pl); plan(tests => 29);
our @ISA = qw/MRO_D MRO_E/;
}
+my @MFO_F_DFS = qw/MRO_F MRO_D MRO_A MRO_B MRO_C MRO_E/;
+my @MFO_F_C3 = qw/MRO_F MRO_D MRO_E MRO_A MRO_B MRO_C/;
is(mro::get_mro('MRO_F'), 'dfs');
ok(eq_array(
- mro::get_linear_isa('MRO_F'),
- [qw/MRO_F MRO_D MRO_A MRO_B MRO_C MRO_E/]
+ mro::get_linear_isa('MRO_F'), \@MFO_F_DFS
));
+
+ok(eq_array(mro::get_linear_isa('MRO_F', 'dfs'), \@MFO_F_DFS));
+ok(eq_array(mro::get_linear_isa('MRO_F', 'c3'), \@MFO_F_C3));
+eval{mro::get_linear_isa('MRO_F', 'C3')};
+like($@, qr/^Invalid mro name: 'C3'/);
+
mro::set_mro('MRO_F', 'c3');
is(mro::get_mro('MRO_F'), 'c3');
ok(eq_array(
- mro::get_linear_isa('MRO_F'),
- [qw/MRO_F MRO_D MRO_E MRO_A MRO_B MRO_C/]
+ mro::get_linear_isa('MRO_F'), \@MFO_F_C3
));
+ok(eq_array(mro::get_linear_isa('MRO_F', 'dfs'), \@MFO_F_DFS));
+ok(eq_array(mro::get_linear_isa('MRO_F', 'c3'), \@MFO_F_C3));
+eval{mro::get_linear_isa('MRO_F', 'C3')};
+like($@, qr/^Invalid mro name: 'C3'/);
+
my @isarev = sort { $a cmp $b } @{mro::get_isarev('MRO_B')};
ok(eq_array(
\@isarev,