Skip to content

Commit

Permalink
fail test if YAML files contain duplicate keys
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmail committed May 15, 2024
1 parent 1e8547c commit 950d0e1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bin/run_tests.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ binmode $builder->failure_output, ":utf8";
binmode $builder->todo_output, ":utf8";


{
# Some YAML parsers croak on duplicate keys. By default the Perl parser
# doesn't. Here we make sure we didn't overlook any duplicate keys.
$YAML::XS::ForbidDuplicateKeys = 1;

my @a_conf_files = File::Find::Rule->file()
->name( '*.yaml' )
->in( dirname(__FILE__) . '/../conf/' );

foreach my $conf_file (@a_conf_files) {
lives_ok { LoadFile($conf_file) } "parsing file $conf_file";
}
}


my $path = dirname(__FILE__) . '/../testcases';

my @files = File::Find::Rule->file()->name( '*.yaml' )->in( $path );
Expand Down

0 comments on commit 950d0e1

Please sign in to comment.