diff options
author | Erlang/OTP <[email protected]> | 2019-05-29 13:24:46 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2019-05-29 13:24:46 +0200 |
commit | 797aca26c3bbf9004f8539433fc1a1a5c27db9fb (patch) | |
tree | 65ca7518f67a324927b6b5bde2e7dd345624d4e8 | |
parent | eecaa6a63e57e0df8c8faae6c0ffe8752b15a39f (diff) | |
parent | 8bdcb96c3c33afd7f85fc2953970b6709f04a74a (diff) | |
download | otp-797aca26c3bbf9004f8539433fc1a1a5c27db9fb.tar.gz otp-797aca26c3bbf9004f8539433fc1a1a5c27db9fb.tar.bz2 otp-797aca26c3bbf9004f8539433fc1a1a5c27db9fb.zip |
Merge branch 'hasse/stdlib/chars_limit_bug/OTP-15847/ERL-957' into maint-22
* hasse/stdlib/chars_limit_bug/OTP-15847/ERL-957:
stdlib: Fix a bug concerning io_lib option 'chars_limit'
# Conflicts:
# lib/stdlib/test/io_SUITE.erl
-rw-r--r-- | lib/stdlib/src/io_lib_pretty.erl | 2 | ||||
-rw-r--r-- | lib/stdlib/test/io_SUITE.erl | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/stdlib/src/io_lib_pretty.erl b/lib/stdlib/src/io_lib_pretty.erl index b1a5991bf0..0cb3b01aae 100644 --- a/lib/stdlib/src/io_lib_pretty.erl +++ b/lib/stdlib/src/io_lib_pretty.erl @@ -780,6 +780,8 @@ printable_bin0(Bin, D, T, Enc) -> end, printable_bin(Bin, Len, D, Enc). +printable_bin(_Bin, 0, _D, _Enc) -> + false; printable_bin(Bin, Len, D, latin1) -> N = erlang:min(20, Len), L = binary_to_list(Bin, 1, N), diff --git a/lib/stdlib/test/io_SUITE.erl b/lib/stdlib/test/io_SUITE.erl index 9b6d8d7401..2478961e59 100644 --- a/lib/stdlib/test/io_SUITE.erl +++ b/lib/stdlib/test/io_SUITE.erl @@ -32,7 +32,7 @@ io_with_huge_message_queue/1, format_string/1, maps/1, coverage/1, otp_14178_unicode_atoms/1, otp_14175/1, otp_14285/1, limit_term/1, otp_14983/1, otp_15103/1, otp_15076/1, - otp_15159/1, otp_15639/1, otp_15705/1]). + otp_15159/1, otp_15639/1, otp_15705/1, otp_15847/1]). -export([pretty/2, trf/3]). @@ -65,7 +65,7 @@ all() -> io_lib_width_too_small, io_with_huge_message_queue, format_string, maps, coverage, otp_14178_unicode_atoms, otp_14175, otp_14285, limit_term, otp_14983, otp_15103, otp_15076, otp_15159, - otp_15639, otp_15705]. + otp_15639, otp_15705, otp_15847]. %% Error cases for output. error_1(Config) when is_list(Config) -> @@ -2708,3 +2708,9 @@ otp_15705(_Config) -> "|кирилли́чес|" = trf("|~10ts|", [U], -1), ok. + +otp_15847(_Config) -> + T = {someRecord,<<"1234567890">>,some,more}, + "{someRecord,<<...>>,...}" = + pretty(T, [{chars_limit,20}, {encoding,latin1}]), + ok. |