aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/io_lib.erl
diff options
context:
space:
mode:
authorAndrew Thompson <[email protected]>2012-09-19 16:54:01 -0400
committerAndrew Thompson <[email protected]>2012-09-19 16:54:01 -0400
commitc83931cbb3516563949d283fe46453a35cd35977 (patch)
treef4bd0d7ab0ca6e6e2f15f8f86ea5b5f9bf37ade8 /lib/stdlib/src/io_lib.erl
parent89ca0448e93beed780bc4c233529ce73063e8337 (diff)
downloadotp-c83931cbb3516563949d283fe46453a35cd35977.tar.gz
otp-c83931cbb3516563949d283fe46453a35cd35977.tar.bz2
otp-c83931cbb3516563949d283fe46453a35cd35977.zip
Fix printing the empty binary at depth 1 with ~W
A case clause ordering problem is causing the empty binary to be printed as <<...>> rather than the correct <<>> when using ~W with a depth of 1. Add new tests to verify correct behaviour.
Diffstat (limited to 'lib/stdlib/src/io_lib.erl')
-rw-r--r--lib/stdlib/src/io_lib.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/stdlib/src/io_lib.erl b/lib/stdlib/src/io_lib.erl
index 0252cdf742..ff5862f7b9 100644
--- a/lib/stdlib/src/io_lib.erl
+++ b/lib/stdlib/src/io_lib.erl
@@ -250,10 +250,10 @@ write_ref(Ref) ->
write_binary(B, D) when is_integer(D) ->
[$<,$<,write_binary_body(B, D),$>,$>].
-write_binary_body(_B, 1) ->
- "...";
write_binary_body(<<>>, _D) ->
"";
+write_binary_body(_B, 1) ->
+ "...";
write_binary_body(<<X:8>>, _D) ->
[integer_to_list(X)];
write_binary_body(<<X:8,Rest/bitstring>>, D) ->