Skip to content

Commit

Permalink
Merge pull request #17 from zeek0x/add-args-info
Browse files Browse the repository at this point in the history
`moyo_assoc:to_map_recur/1` 内の `error` 関数に引数情報を追加
  • Loading branch information
yaoshimax authored Dec 16, 2020
2 parents 6dbd3cd + be0caa4 commit b75a1d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/moyo_assoc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,9 @@ to_map_recur(NestAssocList) ->
is_list(NestAssocList) ->
case to_map_recur_any(NestAssocList) of
Res when (is_map(Res)) -> Res;
_ -> error(badarg)
_ -> error(badarg, [NestAssocList])
end;
true -> error(badarg)
true -> error(badarg, [NestAssocList])
end.

%%----------------------------------------------------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions test/moyo_assoc_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -869,5 +869,9 @@ to_map_recur_test_() ->
{"Keyが同じなら前の値で変換される",
fun() ->
?assertEqual(#{1=>#{1=>2}}, moyo_assoc:to_map_recur([{1, [{1, 2}, {1, 3}]}, {1, 3}]))
end},
{"入力が不正な場合はエラーとなる",
fun() ->
?assertError(badarg, moyo_assoc:to_map_recur(hoge))
end}
].

0 comments on commit b75a1d9

Please sign in to comment.