Add Phone test, it needs more test cases

modify Phone.pm and Float.pm to require digits.
update Float.t to test for at least a digit to pass.
This commit is contained in:
Colin Kuskie 2006-03-27 22:08:27 +00:00
parent 556ab65f5e
commit c64ebee60f
4 changed files with 110 additions and 3 deletions

View file

@ -100,7 +100,7 @@ Returns the integer from the form post, or returns 0.0 if the post result is inv
sub getValueFromPost {
my $self = shift;
my $value = $self->session->form->param($self->get("name"));
if ($value =~ /^-?[\d\.]+$/) {
if ($value =~ /^-?[\d\.]+$/ and $value =~ /\d/) {
return $value;
}
return 0.0;

View file

@ -79,7 +79,7 @@ Returns a string filtered to allow only digits, spaces, and these special charac
sub getValueFromPost {
my $self = shift;
my $value = $self->session->form->param($self->get("name"));
if ($value =~ /^[\d\s\-\+\(\)]+$/) {
if ($value =~ /^[\d \.\-\+\(\)]+$/ and $value =~ /\d/) {
return $value;
}
return undef;