Remove debugging output from Password test

SelectList test is finalized.
Extect auto_check to handle array and scalar accesses to the Form data post processors
This commit is contained in:
Colin Kuskie 2006-03-30 23:34:08 +00:00
parent 2359bd5738
commit 6a035e44b0
3 changed files with 90 additions and 26 deletions

View file

@ -2,6 +2,7 @@ package WebGUI::Form_Checking;
use Test::MockObject;
use Test::More;
use Test::Deep;
sub auto_check {
my ($session, $formType, %testBlock) = @_;
@ -11,17 +12,29 @@ sub auto_check {
$request->mock('body',
sub {
my ($self, $value) = @_;
return $testBlock{$value}->[0] if (exists $testBlock{$value});
return;
return unless exists $testBlock{$value};
if (ref $testBlock{$value}->[0] eq "ARRAY") {
return @{ $testBlock{$value}->[0] };
}
else {
return $testBlock{$value}->[0];
}
}
);
$session->{_request} = $request;
foreach my $key (keys %testBlock) {
my ($testValue, $expected, $comment) = @{ $testBlock{$key} };
my $value = $session->form->get($key, $formType);
is($value, ($expected eq 'EQUAL' ? $testValue : $expected), $comment);
my ($testValue, $expected, $comment, $dataType) = @{ $testBlock{$key} };
$dataType ||= 'SCALAR';
if ($dataType eq 'SCALAR') {
my $value = $session->form->get($key, $formType);
is($value, ($expected eq 'EQUAL' ? $testValue : $expected), $comment);
}
elsif ($dataType eq 'ARRAY') {
my @value = $session->form->get($key, $formType);
cmp_bag(\@value, ($expected eq 'EQUAL' ? $testValue : $expected), $comment);
}
}
$session->{_request} = $origSessionRequest;