@@ -568,6 +568,17 @@ new_spec_pack_test_() ->
568568 ? _assertMatch (<<16#DD , 0 , 1 , 0 , 0 , _ :65536 /binary >>, % % 0xDD, four bytes, N objects
569569 msgpack :pack (list_minus_one (65536 ), [{spec ,new },{pack_str ,PackStr }]))]
570570 || PackStr <- [from_list , from_binary , none ]]
571+ },
572+ {" pack_str from_tagged_list" ,
573+ [? _assertEqual (<<2#101 :3 , 3 :5 , 97 ,97 ,97 >>,
574+ msgpack :pack ({string , " aaa" }, [{spec ,new },{pack_str ,from_tagged_list }])),
575+ ? _assertMatch (<<16#D9 , 32 , _ :32 /binary >>,
576+ msgpack :pack ({string , list_a (32 )}, [{spec ,new },{pack_str ,from_tagged_list }])),
577+ ? _assertMatch (<<16#DA , 1 , 0 , _ :256 /binary >>,
578+ msgpack :pack ({string , list_a (256 )}, [{spec ,new },{pack_str ,from_tagged_list }])),
579+ ? _assertMatch (<<16#DB , 0 , 1 , 0 , 0 , _ :65536 /binary >>,
580+ msgpack :pack ({string , list_a (65536 )}, [{spec ,new },{pack_str ,from_tagged_list }]))
581+ ]
571582 }].
572583
573584new_spec_unpack_test_ () ->
@@ -603,7 +614,9 @@ new_spec_unpack_test_() ->
603614 ? _assertEqual ({ok , list_a (256 )},
604615 msgpack :unpack (<<16#DA , 1 ,0 , (binary_a (256 ))/binary >>, [{spec ,new },{unpack_str ,as_list }])),
605616 ? _assertEqual ({ok , list_a (65536 )},
606- msgpack :unpack (<<16#DB , 0 ,1 ,0 ,0 , (binary_a (65536 ))/binary >>, [{spec ,new },{unpack_str ,as_list }]))
617+ msgpack :unpack (<<16#DB , 0 ,1 ,0 ,0 , (binary_a (65536 ))/binary >>, [{spec ,new },{unpack_str ,as_list }])),
618+ ? _assertEqual ({ok , {string , " aaa" }},
619+ msgpack :unpack (<<2#101 :3 , 3 :5 , 97 ,97 ,97 >>, [{spec ,new },{unpack_str ,as_tagged_list }]))
607620 ]}].
608621
609622unpack_str_validation_test_ () ->
0 commit comments