From c2b5f9f67ce7dbdf7f08f2f57c56a8142a018676 Mon Sep 17 00:00:00 2001 From: Bryan Fink Date: Tue, 29 Nov 2011 14:49:51 -0500 Subject: [PATCH] don't quote atoms just for containing numerals As long as the numeral is not the first character, it shouldn't force quoting on the atom. For example, abc123 does not need quotes. --- src/lager_trunc_io.erl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lager_trunc_io.erl b/src/lager_trunc_io.erl index cd0d6c9..9f06351 100644 --- a/src/lager_trunc_io.erl +++ b/src/lager_trunc_io.erl @@ -297,6 +297,7 @@ atom_needs_quoting([]) -> false; atom_needs_quoting([H|T]) when (H >= $a andalso H =< $z); (H >= $A andalso H =< $Z); + (H >= $0 andalso H =< $9); H == $@; H == $_ -> atom_needs_quoting(T); atom_needs_quoting(_) -> @@ -400,6 +401,7 @@ atom_quoting_test() -> ?assertEqual("hello_world", lists:flatten(format("~p", ['hello_world'], 50))), ?assertEqual("'node@127.0.0.1'", lists:flatten(format("~p", ['node@127.0.0.1'], 50))), ?assertEqual("node@nohost", lists:flatten(format("~p", [node@nohost], 50))), + ?assertEqual("abc123", lists:flatten(format("~p", [abc123], 50))), ok. sane_float_printing_test() ->