Skip to content

Commit

Permalink
Merge pull request #98 from msgpack/test-str
Browse files Browse the repository at this point in the history
Add property tests for string
  • Loading branch information
kuenishi committed Sep 17, 2023
2 parents 4523023 + 086f533 commit 87a3fb5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/prop_msgpack.erl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ prop_msgpack() ->
{msgpack_object(), stable_opts()},
pack_and_unpack(Obj, Opts)).

prop_string() ->
?FORALL({Str, Opts},
{utf8(),
oneof(
[
[],
[{unpack_str, as_list},{pack_str, from_list},{validate_string,true}],
[{unpack_str, as_binary},{pack_str, from_binary},{validate_string,true}],
[{unpack_str, as_tagged_list},{pack_str, from_tagged_list},{validate_string,true}]
])},
pack_and_unpack(unicode:characters_to_list(Str), Opts)).


%%% Helpers %%%
pack_and_unpack(Obj, Opts) ->
Expand Down

0 comments on commit 87a3fb5

Please sign in to comment.