Skip to content

Commit

Permalink
Add test: nested loop variable in implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
perlancar committed Jul 21, 2016
1 parent cfbf75a commit 08858af
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions devscripts/gen-type-spectest
Original file line number Diff line number Diff line change
Expand Up @@ -1908,6 +1908,19 @@ sub gen_hash_tests {
},
);

# this is to test implementation that uses nested loop variable (e.g. $_ in
# perl). we want to make sure that they work.
$sch = [hash => {re_keys => {'[ab]' => [array => {of=>"int"}]}}];
push @res, (
{
name => "re_keys + array[of] (test nested loop variable in implementation)",
schema => $sch,
valid_inputs => [{}, {a=>[]}, {a=>[1]}],
invalid_inputs => [{a=>1}, {a=>["b"]}],
tags => ['clause:re_keys'],
},
);

for my $cl ("req_keys", "req_all_keys", "req_all") {
$sch = [hash => {$cl => []}];
$sch2 = [hash => {$cl => [qw/a b/]}];
Expand Down

0 comments on commit 08858af

Please sign in to comment.