<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
A simplified version:<br>
<blockquote>-module(comperr).<br>
-compile([export_all]).<br>
<br>
split_cases(A) -><br>
case A of<br>
x -> Z = dummy1;<br>
_ -> Z = dummy2, <br>
a=b<br>
end,<br>
case Z of<br>
_ -> ok<br>
end.<br>
</blockquote>
This fails with erts-5.8.4.<br>
<br>
On 20-12-2011 10:01, Håkan Mattsson wrote:
<blockquote
cite="mid:CANRhibtC7Zy=b0jPLmP1+uoG=i6G1atgUUwBhLKdAcFLjK_ehw@mail.gmail.com"
type="cite">
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 12px;"
lang="x-western">
<pre wrap="">-module(foo).
-compile([export_all]).
split_cases(IsRecursive, [Case | Cases], Acc) ->
case binary:split(Case, <<": ">>) of
[<<"qmt file", _/binary>> |_] ->
Qmt = Case,
case Cases of
[Case2 | Cases2] ->
Sections = binary:split(Case2, <<"\n">>, [global]);
[] ->
Sections = binary:split(Case, <<"\n">>, []),
Cases2 = []
end;
[<<"test case", _/binary>> |_] ->
Qmt = <<>>,
Sections = binary:split(Case, <<"\n">>, [global]),
Cases2 = Cases;
[<<>>] ->
io:format("DEBUG: ~p ~p\n", [Case, Cases]),
Qmt = <<>>,
Sections = [],
Cases2 = [],
a=b
end,
case Sections of
[Reason] ->
case binary:split(Qmt, <<": ">>) of
[_, QmtFile] -> ok;
[] -> QmtFile = Qmt
end,
Res = {result_case, QmtFile, <<"ERROR">>, Reason},
split_cases(IsRecursive, Cases2, [Res | Acc]);
[QmtCase, Reason] ->
[_, QmtFile] = binary:split(QmtCase, <<": ">>),
Res =
case binary:split(Reason, <<": ">>) of
[<<"result", _/binary>>, Reason2] ->
{result_case, QmtFile, Reason2, Reason};
[<<"error", _/binary>>, Reason2] ->
{result_case, QmtFile, <<"ERROR">>, Reason2}
end,
split_cases(IsRecursive, Cases2, [Res | Acc]);
[QmtCase, ScriptCase, EventCase | DocAndResult] ->
[_, QmtFile] = binary:split(QmtCase, <<": ">>),
[_, ScriptFile] = binary:split(ScriptCase, <<": ">>),
[_, EventFile] = binary:split(EventCase, <<": ">>),
EventLog = binary_to_list(EventFile),
case IsRecursive of
true ->
case annotate_log(EventLog) of
ok ->
ok;
{error, _, Reason} ->
io:format("ERROR in ~s\n\~p\n", [EventLog, Reason])
end;
false ->
ignore
end,
{Doc, ResultCase} = split_doc(DocAndResult, []),
Result = parse_result(ResultCase),
HtmlLog = EventLog ++ ".html",
Res = {test_case, QmtFile, Qmt, ScriptFile, EventLog, Doc,
HtmlLog, Result},
split_cases(IsRecursive, Cases2, [Res | Acc])
end;
split_cases(_IsRecursive, [], Acc) ->
lists:reverse(Acc).
annotate_log(_EventLog) ->
dummy.
split_doc(_DocAndResult, _Acc) ->
{dummy, dummy}.
parse_result(_ResultCase) ->
dummy.
</pre>
</div>
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 12px;"
lang="x-western">
<pre wrap="">
</pre>
</div>
</blockquote>
<br>
</body>
</html>