diff options
author | John Högberg <[email protected]> | 2018-02-15 16:34:04 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2018-02-15 16:59:12 +0100 |
commit | ca603d7ba3e537670331754539430c704779d5ea (patch) | |
tree | 8cf18141515526a5bad5885fde617de581ff63e9 /erts/emulator/test | |
parent | 309ef748ddc5bde4bcba280ce2739385f27a76e6 (diff) | |
download | otp-ca603d7ba3e537670331754539430c704779d5ea.tar.gz otp-ca603d7ba3e537670331754539430c704779d5ea.tar.bz2 otp-ca603d7ba3e537670331754539430c704779d5ea.zip |
badarg on iolist_to_iovec(Bitstring)
When supplied without an enclosing list, bitstrings were silently
truncated to [] instead of badarging.
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/iovec_SUITE.erl | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/erts/emulator/test/iovec_SUITE.erl b/erts/emulator/test/iovec_SUITE.erl index 49dc64b0d2..abe10f7c20 100644 --- a/erts/emulator/test/iovec_SUITE.erl +++ b/erts/emulator/test/iovec_SUITE.erl @@ -25,7 +25,7 @@ -export([integer_lists/1, binary_lists/1, empty_lists/1, empty_binary_lists/1, mixed_lists/1, improper_lists/1, illegal_lists/1, cons_bomb/1, sub_binary_lists/1, iolist_to_iovec_idempotence/1, - iolist_to_iovec_correctness/1]). + iolist_to_iovec_correctness/1, direct_binary_arg/1]). -include_lib("common_test/include/ct.hrl"). @@ -36,7 +36,8 @@ suite() -> all() -> [integer_lists, binary_lists, empty_lists, empty_binary_lists, mixed_lists, sub_binary_lists, illegal_lists, improper_lists, cons_bomb, - iolist_to_iovec_idempotence, iolist_to_iovec_correctness]. + iolist_to_iovec_idempotence, iolist_to_iovec_correctness, + direct_binary_arg]. init_per_suite(Config) -> Config. @@ -130,6 +131,14 @@ iolist_to_iovec_correctness(Config) when is_list(Config) -> true = is_iolist_equal(Optimized, Variations), ok. +direct_binary_arg(Config) when is_list(Config) -> + {'EXIT',{badarg, _}} = (catch erlang:iolist_to_iovec(<<1:1>>)), + + [<<1>>] = erlang:iolist_to_iovec(<<1>>), + [] = erlang:iolist_to_iovec(<<>>), + + ok. + illegality_test(Fun, Variations) -> [{'EXIT',{badarg, _}} = (catch Fun(Variation)) || Variation <- Variations], ok. |