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:
parent
556ab65f5e
commit
c64ebee60f
4 changed files with 110 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue