瀏覽代碼

Support unicode format string

pull/417/head
suexcxine 7 年之前
父節點
當前提交
0407450784
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. +1
    -1
      src/lager_format.erl
  2. +2
    -1
      src/lager_trunc_io.erl

+ 1
- 1
src/lager_format.erl 查看文件

@ -36,7 +36,7 @@ format(FmtStr, Args, MaxLen, Opts) when is_atom(FmtStr) ->
format(FmtStr, Args, MaxLen, Opts) when is_binary(FmtStr) ->
format(binary_to_list(FmtStr), Args, MaxLen, Opts);
format(FmtStr, Args, MaxLen, Opts) when is_list(FmtStr) ->
case lager_stdlib:string_p(FmtStr) of
case io_lib:deep_char_list(FmtStr) of
true ->
Options = make_options(Opts, #options{}),
Cs = collect(FmtStr, Args),

+ 2
- 1
src/lager_trunc_io.erl 查看文件

@ -874,7 +874,8 @@ depth_limit_test() ->
print_terms_without_format_string_test() ->
?assertError(badarg, format({hello, world}, [], 50)),
?assertError(badarg, format([{google, bomb}], [], 50)),
?assertError(badarg, format([$h,$e,$l,$l,$o, 3594], [], 50)),
?assertEqual([$h,$e,$l,$l,$o, 3594], format([$h,$e,$l,$l,$o, 3594], [], 50)),
?assertError(badarg, format([$h,$e,$l,$l,$o, 65535], [], 50)),
?assertEqual("helloworld", lists:flatten(format([$h,$e,$l,$l,$o, "world"], [], 50))),
?assertEqual("hello", lists:flatten(format(<<"hello">>, [], 50))),
?assertEqual("hello", lists:flatten(format('hello', [], 50))),

Loading…
取消
儲存