[erlang-questions] Test Coverage -- proposed patch in erl_pp

Hans Bolinder hans.bolinder@REDACTED
Mon Oct 15 14:59:05 CEST 2007


[Thomas Arts:]
> For cover analysis during testing it is important to see each clause
> in a case statement on a separate line.
<cut>
> I patched my erl_pp to contain:
> clauses(Type, Hook, Cs) ->
>     {prefer_nl,[$;],lexprs(Cs, Type, Hook)}.
> 
> from the original
> clauses(Type, Hook, Cs) ->
>     expr_list(Cs, [$;], Type, Hook). 
> 
> Would that be a good patch or are there arguments against it that I
> haven't considered?

Seems like a good idea. We will make the patch in R12B.

In order to pretty print

    t() -> receive after 1 -> ok end.

one more modification is needed:

f({prefer_nl,Sep,LItems}, I0, ST, WT) ->
    CharsSize2L = fl(LItems, Sep, I0, [], ST, WT),
    {_CharsL,Sizes} = unz(CharsSize2L),
    if
        Sizes =:= [] ->
            {[], 0};
        true ->
            {insert_newlines(CharsSize2L, I0, ST),nsz(lists:last(Sizes), I0)}
    end;

BTW, erl_pp will be able to handle binary comprehensions in R12B.

Thanks,

Hans Bolinder, Erlang/OTP team



More information about the erlang-questions mailing list