summaryrefslogtreecommitdiff
path: root/lib/NEXT/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-08-14 18:29:19 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-08-14 18:29:19 +0000
commitbf5734d48cfc03fbca4e85c5e0afdb1758ace04f (patch)
tree63b9848aced127dfb9739620856206e5c53171cb /lib/NEXT/t
parentaebbc030f6d3425d30af1549baaeea8adc77a4a8 (diff)
downloadperl-bf5734d48cfc03fbca4e85c5e0afdb1758ace04f.tar.gz
Upgrade to NEXT 0.60.
p4raw-id: //depot/perl@20712
Diffstat (limited to 'lib/NEXT/t')
-rw-r--r--lib/NEXT/t/actual.t29
-rw-r--r--lib/NEXT/t/actuns.t22
-rw-r--r--lib/NEXT/t/unseen.t29
3 files changed, 48 insertions, 32 deletions
diff --git a/lib/NEXT/t/actual.t b/lib/NEXT/t/actual.t
index e45184052b..dbd040da26 100644
--- a/lib/NEXT/t/actual.t
+++ b/lib/NEXT/t/actual.t
@@ -1,3 +1,5 @@
+use Test::More 'no_plan';
+
BEGIN {
if ($ENV{PERL_CORE}) {
chdir('t') if -d 't';
@@ -5,27 +7,31 @@ BEGIN {
}
}
-BEGIN { print "1..9\n"; }
-use NEXT;
-
-my $count=1;
+BEGIN { use_ok('NEXT') };
+my $order = 0;
package A;
@ISA = qw/B C D/;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::test;}
+sub test { ++$order; ::ok($order==1,"test A"); $_[0]->NEXT::ACTUAL::test;}
package B;
-@ISA = qw/C D/;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::test;}
+@ISA = qw/D C/;
+sub test { ++$order; ::ok($order==2,"test B"); $_[0]->NEXT::ACTUAL::test;}
package C;
@ISA = qw/D/;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::test;}
+sub test {
+ ++$order; ::ok($order==4||$order==6,"test C");
+ $_[0]->NEXT::ACTUAL::test;
+}
package D;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::test;}
+sub test {
+ ++$order; ::ok($order==3||$order==5||$order==7||$order==8,"test D");
+ $_[0]->NEXT::ACTUAL::test;
+}
package main;
@@ -33,5 +39,6 @@ my $foo = {};
bless($foo,"A");
-eval { $foo->test } and print "not ";
-print "ok 9\n";
+eval{ $foo->test }
+ ? fail("Didn't die on missing ancestor")
+ : pass("Correctly dies after full traversal");
diff --git a/lib/NEXT/t/actuns.t b/lib/NEXT/t/actuns.t
index aca30c7d26..a99fbe5256 100644
--- a/lib/NEXT/t/actuns.t
+++ b/lib/NEXT/t/actuns.t
@@ -1,3 +1,5 @@
+use Test::More 'no_plan';
+
BEGIN {
if ($ENV{PERL_CORE}) {
chdir('t') if -d 't';
@@ -5,27 +7,25 @@ BEGIN {
}
}
-BEGIN { print "1..6\n"; }
-use NEXT;
-
-my $count=1;
+BEGIN { use_ok('NEXT') };
+my $order = 0;
package A;
@ISA = qw/B C D/;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::ACTUAL::test;}
+sub test { ::ok(++$order==1,"test A"); $_[0]->NEXT::UNSEEN::ACTUAL::test;}
package B;
-@ISA = qw/C D/;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::UNSEEN::test;}
+@ISA = qw/D C/;
+sub test { ::ok(++$order==2,"test B"); $_[0]->NEXT::ACTUAL::UNSEEN::test;}
package C;
@ISA = qw/D/;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::ACTUAL::test;}
+sub test { ::ok(++$order==4,"test C"); $_[0]->NEXT::UNSEEN::ACTUAL::test;}
package D;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::UNSEEN::test;}
+sub test { ::ok(++$order==3,"test D"); $_[0]->NEXT::ACTUAL::UNSEEN::test;}
package main;
@@ -33,4 +33,6 @@ my $foo = {};
bless($foo,"A");
-eval { $foo->test } and print "not ";
+eval{ $foo->test }
+ ? fail("Didn't die on missing ancestor")
+ : pass("Correctly dies after C");
diff --git a/lib/NEXT/t/unseen.t b/lib/NEXT/t/unseen.t
index ddaab1851a..1304ad67b5 100644
--- a/lib/NEXT/t/unseen.t
+++ b/lib/NEXT/t/unseen.t
@@ -1,3 +1,5 @@
+use Test::More 'no_plan';
+
BEGIN {
if ($ENV{PERL_CORE}) {
chdir('t') if -d 't';
@@ -5,27 +7,25 @@ BEGIN {
}
}
-BEGIN { print "1..10\n"; }
-use NEXT;
-
-my $count=1;
+BEGIN { use_ok('NEXT') };
+my $order = 0;
package A;
@ISA = qw/B C D/;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::test;}
+sub test { ::ok(++$order==1,"test A"); $_[0]->NEXT::UNSEEN::test; 1}
package B;
-@ISA = qw/C D/;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::test;}
+@ISA = qw/D C/;
+sub test { ::ok(++$order==2,"test B"); $_[0]->NEXT::UNSEEN::test; 1}
package C;
@ISA = qw/D/;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::test;}
+sub test { ::ok(++$order==4,"test C"); $_[0]->NEXT::UNSEEN::test; 1}
package D;
-sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::test;}
+sub test { ::ok(++$order==3,"test D"); $_[0]->NEXT::UNSEEN::test; 1}
package main;
@@ -33,10 +33,17 @@ my $foo = {};
bless($foo,"A");
-$foo->test;
+eval{ $foo->test }
+ ? pass("Correctly survives after C")
+ : fail("Shouldn't die on missing ancestor");
package Diamond::Base;
-sub test { print "ok ", $count++, "\n"; shift->NEXT::UNSEEN::test; }
+my $seen;
+sub test {
+ $seen++ ? ::fail("Can't visit inherited test twice")
+ : ::pass("First diamond is okay");
+ shift->NEXT::UNSEEN::test;
+}
package Diamond::Left; @ISA = qw[Diamond::Base];
package Diamond::Right; @ISA = qw[Diamond::Base];