diff options
author | Erlang/OTP <[email protected]> | 2019-06-12 09:51:22 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2019-06-12 09:51:22 +0200 |
commit | aa5a674421f5485bfd479ae4445ce66959dc1b75 (patch) | |
tree | e868a99f76fd57af9393d6310d8ac7a26d2eaf0a /lib/stdlib | |
parent | 28e30d0e5c3bfb97c739092996fa21308b3befd6 (diff) | |
parent | acc3b04fb0128fca1770a3823b6651f632d73939 (diff) | |
download | otp-aa5a674421f5485bfd479ae4445ce66959dc1b75.tar.gz otp-aa5a674421f5485bfd479ae4445ce66959dc1b75.tar.bz2 otp-aa5a674421f5485bfd479ae4445ce66959dc1b75.zip |
Merge branch 'hasse/stdlib/chars_limit_bug/OTP-15875/ERL-967' into maint-22
* hasse/stdlib/chars_limit_bug/OTP-15875/ERL-967:
stdlib: Fix a bug concerning io_lib option 'chars_limit'
# Conflicts:
# lib/stdlib/test/io_SUITE.erl
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/src/io_lib_pretty.erl | 4 | ||||
-rw-r--r-- | lib/stdlib/test/io_SUITE.erl | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/stdlib/src/io_lib_pretty.erl b/lib/stdlib/src/io_lib_pretty.erl index 0cb3b01aae..77f02eafe0 100644 --- a/lib/stdlib/src/io_lib_pretty.erl +++ b/lib/stdlib/src/io_lib_pretty.erl @@ -462,7 +462,9 @@ find_upper(Lower, Term, T, Dl, Dd, D, RF, Enc, Str) -> case If of {_, _, _Dots=0, _} -> % even if Len > T If; - {_, Len, _, _} when Len =< T, D1 < D orelse D < 0 -> + {_, _Len=T, _, _} -> % increasing the depth is meaningless + If; + {_, Len, _, _} when Len < T, D1 < D orelse D < 0 -> find_upper(If, Term, T, D1, Dd2, D, RF, Enc, Str); _ -> search_depth(Lower, If, Term, T, Dl, D1, RF, Enc, Str) diff --git a/lib/stdlib/test/io_SUITE.erl b/lib/stdlib/test/io_SUITE.erl index 2478961e59..4eb5b1772c 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_15847/1]). + otp_15159/1, otp_15639/1, otp_15705/1, otp_15847/1, otp_15875/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_15847]. + otp_15639, otp_15705, otp_15847, otp_15875]. %% Error cases for output. error_1(Config) when is_list(Config) -> @@ -2714,3 +2714,7 @@ otp_15847(_Config) -> "{someRecord,<<...>>,...}" = pretty(T, [{chars_limit,20}, {encoding,latin1}]), ok. + +otp_15875(_Config) -> + S = io_lib:format("~tp", [[{0, [<<"00">>]}]], [{chars_limit, 18}]), + "[{0,[<<48,...>>]}]" = lists:flatten(S). |