Skip to content

Commit

Permalink
fixed dotw tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barbie committed Sep 28, 2014
1 parent c388506 commit ec4a7eb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/Calendar/Functions.pm
Expand Up @@ -245,7 +245,7 @@ sub format_date {
my $fmon = sprintf "%02d", $mon;
my $fyear = sprintf "%04d", $year;
my $fmonth = sprintf "%s", $months[$mon];
my $fdotw = sprintf "%s", (defined $dotw ? $dotw[$dotw] : '');
my $fdotw = sprintf "%s", $dotw[$dotw];
my $fddext = sprintf "%d%s", $day, ext($day);
my $amonth = substr($fmonth,0,3);
my $adotw = substr($fdotw,0,3);
Expand Down Expand Up @@ -369,7 +369,7 @@ name if passed a numeric.
sub dotw {
return $dotw[$_[0]] if($_[0] =~ /\d/);

foreach my $inx (1..12) {
foreach my $inx (0..6) {
return $inx if($_[0] =~ /$dotw[$inx]/i);
}

Expand Down
6 changes: 3 additions & 3 deletions t/10functions.t
Expand Up @@ -10,9 +10,9 @@ use Calendar::Functions qw(:form);
# Note this test is for the base functions that don't rely on other modules

# The basic functions
foreach my $test (keys %exts) { is(ext($test),$exts{$test}) }
foreach my $test (keys %monthtest) { is(moty($test),$monthtest{$test}) }
foreach my $test (keys %daytest) { is(dotw($test),$daytest{$test}) }
for my $test (sort keys %exts) { is(ext($test), $exts{$test}, ".. passed ext test $test") }
for my $test (sort keys %monthtest) { is(moty($test),$monthtest{$test}, ".. passed moty test $test") }
for my $test (sort keys %daytest) { is(dotw($test),$daytest{$test}, ".. passed dotw test $test") }

# date formatting
foreach my $test (@format01) {
Expand Down
4 changes: 2 additions & 2 deletions t/TestData.pm
Expand Up @@ -692,7 +692,7 @@ q|<select name='TestTest'>
31 => 'st',
);

my %monthtest = (
%monthtest = (
1 => 'January',
2 => 'February',
3 => 'March',
Expand All @@ -719,7 +719,7 @@ my %monthtest = (
'December' => 12,
);

my %daytest = (
%daytest = (
0 => 'Sunday',
1 => 'Monday',
2 => 'Tuesday',
Expand Down

0 comments on commit ec4a7eb

Please sign in to comment.