Skip to content
Permalink
Browse files

Metadata sanity checks

  • Loading branch information...
jbarrett committed Mar 15, 2019
1 parent e108f11 commit ca6663f70865121c6a9523fa95ed9a390c698cd7
Showing with 36 additions and 0 deletions.
  1. +2 −0 cpanfile
  2. +34 −0 t/01-meta.t
  3. 0 t/{01-format.t → 02-format.t}
@@ -1 +1,3 @@
requires 'Cpanel::JSON::XS';
requires 'Locale::PO';
requires 'Test::Fatal';
@@ -0,0 +1,34 @@
use strict;
use warnings;

use Test::More;
use File::Basename;
use Cpanel::JSON::XS qw/ decode_json /;
use Scalar::Util qw/ reftype /;
use Test::Fatal qw/ lives_ok /;

chdir dirname(__FILE__) . "/..";

my $locales;
my $file = 'locales.json';

lives_ok {
$locales = decode_json( do {
local $/ = undef;
open my $fh, '<', $file or die "could not open $file: $!";
<$fh>;
} )
} 'locales.json parsed OK';

is( reftype $locales, 'HASH', 'locales data appears to exist' );
my @locale_codes = keys %{ $locales };
ok( @locale_codes > 0, 'locales data appears to be populated' );

for my $locale_code ( @locale_codes ) {
for my $key ( qw/ locale name_in_english name_in_local rtl / ) {
ok( defined( $locales->{ $locale_code }->{ $key } ),
"$key defined for $locale_code" );
}
}

done_testing;
File renamed without changes.

0 comments on commit ca6663f

Please sign in to comment.
You can’t perform that action at this time.