add prototype Test code to allow Test::Maker modules to handle TODO
This commit is contained in:
parent
2eb1883345
commit
c8a8af6b4a
2 changed files with 6 additions and 3 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
package WebGUI::Test::Maker;
|
package WebGUI::Test::Maker;
|
||||||
|
|
||||||
use Test::More;
|
use base 'Test::Builder::Module';
|
||||||
|
|
||||||
|
my $CLASS = __PACKAGE__;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ use Scalar::Util qw( blessed );
|
||||||
use Carp qw( croak );
|
use Carp qw( croak );
|
||||||
use Test::More;
|
use Test::More;
|
||||||
|
|
||||||
|
my $CLASS = __PACKAGE__;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|
@ -269,6 +270,7 @@ sub runUsers {
|
||||||
my ($session, $object, $method, $precedingArguments,
|
my ($session, $object, $method, $precedingArguments,
|
||||||
$users, $passing, $comment ) = @_;
|
$users, $passing, $comment ) = @_;
|
||||||
my $failing = !$passing;
|
my $failing = !$passing;
|
||||||
|
my $tb = $CLASS->builder;
|
||||||
foreach my $userId (@{ $users }) {
|
foreach my $userId (@{ $users }) {
|
||||||
my @args = @{ $precedingArguments };
|
my @args = @{ $precedingArguments };
|
||||||
my $oldUser = $session->user;
|
my $oldUser = $session->user;
|
||||||
|
|
@ -276,7 +278,7 @@ sub runUsers {
|
||||||
my $role = $session->user->username
|
my $role = $session->user->username
|
||||||
? "user ".$session->user->username
|
? "user ".$session->user->username
|
||||||
: "userId ".$userId;
|
: "userId ".$userId;
|
||||||
ok(
|
$tb->ok(
|
||||||
( $object->$method(@args) xor $failing ),
|
( $object->$method(@args) xor $failing ),
|
||||||
"$role passes $method check using default user for " . $comment
|
"$role passes $method check using default user for " . $comment
|
||||||
);
|
);
|
||||||
|
|
@ -285,7 +287,7 @@ sub runUsers {
|
||||||
# Test the specified userId
|
# Test the specified userId
|
||||||
push @args, $userId;
|
push @args, $userId;
|
||||||
# Test the userId parameter
|
# Test the userId parameter
|
||||||
ok(
|
$tb->ok(
|
||||||
( $object->$method(@args) xor $failing ),
|
( $object->$method(@args) xor $failing ),
|
||||||
"$role passes $method check for " . $comment
|
"$role passes $method check for " . $comment
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue