Skip to content

Commit

Permalink
Test ->datetime_formats method (and add it so it exists)
Browse files Browse the repository at this point in the history
  • Loading branch information
autarch committed Jul 15, 2012
1 parent c9a4782 commit edd3c7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
9 changes: 9 additions & 0 deletions lib/DateTime/Locale/Base.pm
Expand Up @@ -74,6 +74,15 @@ sub time_formats {
};
}

sub datetime_formats {
return {
map {
my $meth = 'datetime_format_' . $_;
$_ => $_[0]->$meth()
} @FormatLengths
};
}

sub format_for {
my $self = shift;
my $for = shift;
Expand Down
17 changes: 3 additions & 14 deletions t/01basic.t
Expand Up @@ -11,20 +11,6 @@ my @locale_ids = sort DateTime::Locale->ids();
my %locale_names = map { $_ => 1 } DateTime::Locale->names;
my %locale_ids = map { $_ => 1 } DateTime::Locale->ids;

plan tests => 5 # starting
+ 1 # load test for root locale
+ ( ( @locale_ids - 1 ) * 21 ) # test each local
+ 67 # check_root
+ 24 # check_en
+ 64 # check_en_GB
+ 23 # check_en_US
+ 11 # check_es_ES
+ 5 # check_en_US_POSIX
+ 2 # check_af
+ 18 # check_zh_TW
+ 9 # check_DT_Lang
;

{
ok( @locale_ids >= 240, 'Coverage looks complete' );
ok( $locale_names{English}, "Locale name 'English' found" );
Expand Down Expand Up @@ -110,6 +96,7 @@ plan tests => 5 # starting

check_formats( $locale_id, $locale, 'date_formats', 'date_format' );
check_formats( $locale_id, $locale, 'time_formats', 'time_format' );
check_formats( $locale_id, $locale, 'datetime_formats', 'datetime_format' );
}
}

Expand All @@ -123,6 +110,8 @@ check_af();
check_zh_TW();
check_DT_Lang();

done_testing();

sub check_array {
my %test = @_;

Expand Down

0 comments on commit edd3c7d

Please sign in to comment.