Ver código fonte

ft:测试代码添加

master
lijie 2 anos atrás
pai
commit
cd61210d35
2 arquivos alterados com 15 adições e 19 exclusões
  1. +10
    -14
      src/eFmt.erl
  2. +5
    -5
      src/test/recon-2.5.1/fmtTest.erl

+ 10
- 14
src/eFmt.erl Ver arquivo

@ -35,8 +35,8 @@
format/2
, format/3
, formatBin/2
, formatBin/3
, formatIol/2
, formatIol/3
, scan/2
, build/1
@ -86,7 +86,7 @@ on_load() ->
-spec format(Format :: format(), Data :: [term()]) -> chars().
format(Format, Args) ->
try fWrite(Format, Args)
try iolist_to_binary(fWrite(Format, Args))
catch
C:R:S ->
erlang:error(badarg, [Format, Args, {C, R, S}])
@ -94,27 +94,23 @@ format(Format, Args) ->
-spec format(Format :: format(), Data :: [term()], Options :: [{charsLimit, CharsLimit :: charsLimit()}]) -> chars().
format(Format, Args, Options) ->
try fWrite(Format, Args, Options)
try iolist_to_binary(fWrite(Format, Args, Options))
catch
C:R:S ->
erlang:error(badarg, [Format, Args, {C, R, S}])
end.
-spec formatBin(Format :: format(), Data :: [term()]) -> chars().
formatBin(Format, Args) ->
try fWrite(Format, Args) of
Ret ->
iolist_to_binary(Ret)
-spec formatIol(Format :: format(), Data :: [term()]) -> chars().
formatIol(Format, Args) ->
try fWrite(Format, Args)
catch
C:R:S ->
erlang:error(badarg, [Format, Args, {C, R, S}])
end.
-spec formatBin(Format :: format(), Data :: [term()], Options :: [{charsLimit, CharsLimit :: charsLimit()}]) -> chars().
formatBin(Format, Args, Options) ->
try fWrite(Format, Args, Options) of
Ret ->
iolist_to_binary(Ret)
-spec formatIol(Format :: format(), Data :: [term()], Options :: [{charsLimit, CharsLimit :: charsLimit()}]) -> chars().
formatIol(Format, Args, Options) ->
try fWrite(Format, Args, Options)
catch
C:R:S ->
erlang:error(badarg, [Format, Args, {C, R, S}])

+ 5
- 5
src/test/recon-2.5.1/fmtTest.erl Ver arquivo

@ -1,22 +1,22 @@
-module(fmtTest).
-compile([export_all]).
-compile([export_all, nowarn_export_all]).
tt1(FmtBinStr) ->
split(FmtBinStr, <<"~">>).
binary:split(FmtBinStr, <<"~">>).
tt2(FmtBinStr) ->
split(FmtBinStr, persistent_term:get(eFmtPtMc)).
binary:split(FmtBinStr, persistent_term:get(eFmtPtMc)).
tt5(F) ->
string:split(F, "~").
tt3(<<>>) ->
ok;
tt3(<<F/utf8, L/binary>>) ->
tt3(<<_F/utf8, L/binary>>) ->
tt3(L).
tt4([]) ->
ok;
tt4([F | L]) ->
tt4([_F | L]) ->
tt4(L).

Carregando…
Cancelar
Salvar