From c42cba1d5453f718a85f49f7441387ed4d0a7210 Mon Sep 17 00:00:00 2001 From: UENISHI Kota Date: Fri, 27 Aug 2010 23:02:16 +0900 Subject: [PATCH] erlang: fixed bug around error case when serializing atom. --- erlang/msgpack.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erlang/msgpack.erl b/erlang/msgpack.erl index b54874d5..8c85458e 100644 --- a/erlang/msgpack.erl +++ b/erlang/msgpack.erl @@ -126,7 +126,7 @@ pack_(List) when is_list(List) -> pack_({Map}) when is_list(Map) -> pack_map(Map); pack_(Other) -> - throw({error, {badarg, Other}}). + throw({badarg, Other}). -spec pack_uint_(non_neg_integer()) -> binary(). @@ -387,4 +387,9 @@ benchmark_test()-> {Data,<<>>}=?debugTime("deserialize", msgpack:unpack(S)), ?debugFmt("for ~p KB test data.", [byte_size(S) div 1024]). +error_test()-> + ?assertEqual({error,{badarg, atom}}, msgpack:pack(atom)), + Term = {"hoge", "hage", atom}, + ?assertEqual({error,{badarg, Term}}, msgpack:pack(Term)). + -endif.