|
|
@ -394,6 +394,11 @@ alist([H|T], Max, Options) when H =:= $\t; H =:= $\n; H =:= $\r; H =:= $\v; H =: |
|
|
|
alist([H|T], Max, #print_options{force_strings=true} = Options) when is_integer(H) -> |
|
|
|
{L, Len} = alist(T, Max-1, Options), |
|
|
|
{[H|L], Len + 1}; |
|
|
|
alist([H|T], Max, Options = #print_options{force_strings=true}) when is_binary(H) -> |
|
|
|
{List, Len} = print(H, Max, Options), |
|
|
|
%% no need to decrement depth, as we're in printable string mode |
|
|
|
{Final, FLen} = alist(T, Max - Len, Options), |
|
|
|
{[List|Final], FLen}; |
|
|
|
alist(_, _, #print_options{force_strings=true}) -> |
|
|
|
erlang:error(badarg); |
|
|
|
alist([H|_L], _Max, _Options) -> |
|
|
@ -650,6 +655,11 @@ list_printing_test() -> |
|
|
|
?assertEqual("[9|9]", lists:flatten(format("~p", [[9|9]], 50))), |
|
|
|
ok. |
|
|
|
|
|
|
|
iolist_printing_test() -> |
|
|
|
?assertEqual("iolist: HelloIamaniolist", |
|
|
|
lists:flatten(format("iolist: ~s", [[$H, $e, $l, $l, $o, "I", ["am", [<<"an">>], [$i, $o, $l, $i, $s, $t]]]], 1000))), |
|
|
|
ok. |
|
|
|
|
|
|
|
tuple_printing_test() -> |
|
|
|
?assertEqual("{}", lists:flatten(format("~p", [{}], 50))), |
|
|
|
?assertEqual("{}", lists:flatten(format("~w", [{}], 50))), |
|
|
|