diff options
author | Erlang/OTP <[email protected]> | 2018-06-05 11:57:21 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2018-06-05 11:57:21 +0200 |
commit | 3d57a62f8ed1ee95096fbba68f179dc33f2b4dbd (patch) | |
tree | 7be47838f9b815128d1beabec08cc6c8a2b36a1c /erts/emulator/test/nif_SUITE.erl | |
parent | 40ab3958644be3fc14682c54233514fdf880386a (diff) | |
parent | d7bacbc798d608f259eb2faaaf194cb9df323018 (diff) | |
download | otp-3d57a62f8ed1ee95096fbba68f179dc33f2b4dbd.tar.gz otp-3d57a62f8ed1ee95096fbba68f179dc33f2b4dbd.tar.bz2 otp-3d57a62f8ed1ee95096fbba68f179dc33f2b4dbd.zip |
Merge branch 'sverker/enif_binary_to_term-bug/OTP-15080' into maint-20
* sverker/enif_binary_to_term-bug/OTP-15080:
erts: Fix bug in enif_binary_to_term for immediates
Diffstat (limited to 'erts/emulator/test/nif_SUITE.erl')
-rw-r--r-- | erts/emulator/test/nif_SUITE.erl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/erts/emulator/test/nif_SUITE.erl b/erts/emulator/test/nif_SUITE.erl index ac2b136a38..4237715c4b 100644 --- a/erts/emulator/test/nif_SUITE.erl +++ b/erts/emulator/test/nif_SUITE.erl @@ -2594,16 +2594,23 @@ nif_term_to_binary(Config) -> nif_binary_to_term(Config) -> ensure_lib_loaded(Config), - T = {#{ok => nok}, <<0:8096>>, lists:seq(1,100)}, + BigMap = maps:from_list([{I,-I} || I <- lists:seq(1,100)]), + [nif_binary_to_term_do(T) + || T <- [{#{ok => nok}, <<0:8096>>, lists:seq(1,100)}, + atom, 42, self(), BigMap]], + ok. + +nif_binary_to_term_do(T) -> + Dummy = [true|false], Bin = term_to_binary(T), Len = byte_size(Bin), - {Len,T} = binary_to_term_nif(Bin, undefined, 0), + {Len,T,Dummy} = binary_to_term_nif(Bin, undefined, 0), Len = binary_to_term_nif(Bin, self(), 0), - T = receive M -> M after 1000 -> timeout end, + {T,Dummy} = receive M -> M after 1000 -> timeout end, - {Len, T} = binary_to_term_nif(Bin, undefined, ?ERL_NIF_BIN2TERM_SAFE), + {Len,T,Dummy} = binary_to_term_nif(Bin, undefined, ?ERL_NIF_BIN2TERM_SAFE), false = binary_to_term_nif(<<131,100,0,14,"undefined_atom">>, - undefined, ?ERL_NIF_BIN2TERM_SAFE), + undefined, ?ERL_NIF_BIN2TERM_SAFE), false = binary_to_term_nif(Bin, undefined, 1), ok. |