Skip to content

Commit

Permalink
handle empty dictionaries
Browse files Browse the repository at this point in the history
  • Loading branch information
wjackson committed Aug 23, 2012
1 parent 9fa2cf8 commit a974129
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 1 addition & 4 deletions kparse.c
Expand Up @@ -182,11 +182,8 @@ SV* xd_from_k(K k) {
if (kK(k)[0]->t == XT && kK(k)[1]->t == XT) {
return ptable_from_k(k);
}
else if (kK(k)[0]->t == KS) {
return dict_from_k(k);
}
else {
croak("Unrecognized XD (dictionary) form");
return dict_from_k(k);
}
}

Expand Down
5 changes: 5 additions & 0 deletions t/raw.t
Expand Up @@ -233,6 +233,11 @@ sub dict_test {
k($handle, '`foo`bar!(0n;`)'),
{ foo => undef, bar => undef },
'parse dictionary w/ null values';

is_deeply
k($handle, '()!()'),
{},
'parse empty dictionary';
}

sub table_test {
Expand Down

0 comments on commit a974129

Please sign in to comment.