projects
/
irspy-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8976789
)
_run_test() now detects loops.
author
Mike Taylor
<mike@indexdata.com>
Fri, 21 Jul 2006 11:50:17 +0000
(11:50 +0000)
committer
Mike Taylor
<mike@indexdata.com>
Fri, 21 Jul 2006 11:50:17 +0000
(11:50 +0000)
lib/ZOOM/IRSpy.pm
patch
|
blob
|
history
diff --git
a/lib/ZOOM/IRSpy.pm
b/lib/ZOOM/IRSpy.pm
index
d9674b7
..
705cf79
100644
(file)
--- a/
lib/ZOOM/IRSpy.pm
+++ b/
lib/ZOOM/IRSpy.pm
@@
-1,4
+1,4
@@
-# $Id: IRSpy.pm,v 1.9 2006-07-21 11:28:16 mike Exp $
+# $Id: IRSpy.pm,v 1.10 2006-07-21 11:50:17 mike Exp $
package ZOOM::IRSpy;
package ZOOM::IRSpy;
@@
-49,6
+49,7
@@
sub new {
targets => undef, # filled in later
target2record => undef, # filled in later
pod => undef, # filled in later
targets => undef, # filled in later
target2record => undef, # filled in later
pod => undef, # filled in later
+ tests => [], # stack of tests currently being executed
}, $class;
$this->log("irspy", "starting up with database '$dbname'");
}, $class;
$this->log("irspy", "starting up with database '$dbname'");
@@
-100,7
+101,7
@@
sub _parse_target_string {
($host, $db) = ($target =~ /(.*?)\/(.*)/);
$target = "$host:$port/$db";
}
($host, $db) = ($target =~ /(.*?)\/(.*)/);
$target = "$host:$port/$db";
}
- die "invalid target string '$target'"
+ die "$0: invalid target string '$target'"
if !defined $host;
return ($host, $port, $db, $target);
if !defined $host;
return ($host, $port, $db, $target);
@@
-200,6
+201,10
@@
sub _run_test {
my $this = shift();
my($tname) = @_;
my $this = shift();
my($tname) = @_;
+ die("$0: test-hierarchy loop detected: " .
+ join(" -> ", @{ $this->{tests} }, $tname))
+ if grep { $_ eq $tname } @{ $this->{tests} };
+
eval {
my $slashSeperatedTname = $tname;
$slashSeperatedTname =~ s/::/\//g;
eval {
my $slashSeperatedTname = $tname;
$slashSeperatedTname =~ s/::/\//g;
@@
-211,8
+216,11
@@
sub _run_test {
}
$this->log("irspy", "running test '$tname'");
}
$this->log("irspy", "running test '$tname'");
+ push @{ $this->{tests} }, $tname;
my $test = "ZOOM::IRSpy::Test::$tname"->new($this);
my $test = "ZOOM::IRSpy::Test::$tname"->new($this);
- return $test->run();
+ my $res =$test->run();
+ pop @{ $this->{tests} };
+ return $res;
}
}