From 2f460f4a01ac24ac54ea13072ba694032a69868f Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Tue, 15 Apr 2014 04:55:37 +0900 Subject: [PATCH] Use unpack_map_jiffy by default --- include/msgpack.hrl | 2 +- test/msgpack_test.erl | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/msgpack.hrl b/include/msgpack.hrl index c2a7532..7ad4d1e 100644 --- a/include/msgpack.hrl +++ b/include/msgpack.hrl @@ -82,7 +82,7 @@ -else. -record(options_v3, { interface = jiffy :: format_type(), - map_unpack_fun = fun msgpack_unpacker:unpack_map/3 :: + map_unpack_fun = fun msgpack_unpacker:unpack_map_jiffy/3 :: msgpack_map_unpacker(), impl = erlang :: erlang | nif, allow_atom = none :: none | pack, %% allows atom when packing diff --git a/test/msgpack_test.erl b/test/msgpack_test.erl index 07b799e..bfa503d 100644 --- a/test/msgpack_test.erl +++ b/test/msgpack_test.erl @@ -176,7 +176,20 @@ string_test() -> MsgpackStringBin = msgpack:pack(String), {ok, String} = msgpack:unpack(MsgpackStringBin). - +default_test_() -> + [ + {"pack", + fun() -> + Map = {[{1,2}]}, + ?assertEqual(pack(Map, [{format, jiffy}]), pack(Map)) + end}, + {"unpack", + fun() -> + Map = {[{1,2}]}, + Binary = pack(Map, [{format, jiffy}]), + ?assertEqual(unpack(Binary, [{format, jiffy}]), unpack(Binary)) + end} + ]. unpack_test_() -> [