erlang: fixed bug around error case when serializing atom.

This commit is contained in:
UENISHI Kota 2010-08-27 23:02:16 +09:00
parent dcbcf5842f
commit c42cba1d54

View File

@ -126,7 +126,7 @@ pack_(List) when is_list(List) ->
pack_({Map}) when is_list(Map) -> pack_({Map}) when is_list(Map) ->
pack_map(Map); pack_map(Map);
pack_(Other) -> pack_(Other) ->
throw({error, {badarg, Other}}). throw({badarg, Other}).
-spec pack_uint_(non_neg_integer()) -> binary(). -spec pack_uint_(non_neg_integer()) -> binary().
@ -387,4 +387,9 @@ benchmark_test()->
{Data,<<>>}=?debugTime("deserialize", msgpack:unpack(S)), {Data,<<>>}=?debugTime("deserialize", msgpack:unpack(S)),
?debugFmt("for ~p KB test data.", [byte_size(S) div 1024]). ?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. -endif.