2004-09-08 18:26:33 +02:00
|
|
|
# $Id$
|
|
|
|
|
|
|
|
package Test::Qpsmtpd::Plugin;
|
|
|
|
1;
|
|
|
|
|
|
|
|
# Additional plugin methods used during testing
|
|
|
|
package Qpsmtpd::Plugin;
|
|
|
|
|
|
|
|
use Test::More;
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
sub register_tests {
|
|
|
|
# Virtual base method - implement in plugin
|
|
|
|
}
|
|
|
|
|
|
|
|
sub register_test {
|
|
|
|
my ($plugin, $test, $num_tests) = @_;
|
|
|
|
$num_tests = 1 unless defined($num_tests);
|
|
|
|
# print STDERR "Registering test $test ($num_tests)\n";
|
|
|
|
push @{$plugin->{_tests}}, { name => $test, num => $num_tests };
|
|
|
|
}
|
|
|
|
|
|
|
|
sub total_tests {
|
|
|
|
my ($plugin) = @_;
|
|
|
|
my $total = 0;
|
|
|
|
foreach my $t (@{$plugin->{_tests}}) {
|
|
|
|
$total += $t->{num};
|
|
|
|
}
|
|
|
|
return $total;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub run_tests {
|
2004-09-08 23:48:27 +02:00
|
|
|
my ($plugin, $qp) = @_;
|
2004-09-08 18:26:33 +02:00
|
|
|
foreach my $t (@{$plugin->{_tests}}) {
|
|
|
|
my $method = $t->{name};
|
2004-09-08 23:53:29 +02:00
|
|
|
print "# Running $method tests for plugin " . $plugin->plugin_name . "\n";
|
2004-09-08 23:48:27 +02:00
|
|
|
local $plugin->{_qp} = $qp;
|
2004-09-08 18:26:33 +02:00
|
|
|
$plugin->$method();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|