aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/cth_surefire.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2012-05-08 17:47:21 +0200
committerPeter Andersson <[email protected]>2012-05-10 16:25:26 +0200
commite711632042d1538fce80d565a2add309a88efa1b (patch)
treea3fb0cf3892fd1f471ff69b2e119ee67c89f6040 /lib/common_test/src/cth_surefire.erl
parentaf287d7b242b27a05084580f110db2f4a6667e54 (diff)
downloadotp-e711632042d1538fce80d565a2add309a88efa1b.tar.gz
otp-e711632042d1538fce80d565a2add309a88efa1b.tar.bz2
otp-e711632042d1538fce80d565a2add309a88efa1b.zip
Fix IO printout crash caused by hook function
Diffstat (limited to 'lib/common_test/src/cth_surefire.erl')
-rw-r--r--lib/common_test/src/cth_surefire.erl13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/common_test/src/cth_surefire.erl b/lib/common_test/src/cth_surefire.erl
index c42f956b3a..ef7fe6c455 100644
--- a/lib/common_test/src/cth_surefire.erl
+++ b/lib/common_test/src/cth_surefire.erl
@@ -83,16 +83,21 @@ pre_init_per_testcase(_TC,Config,State) -> {Config, init_tc(State, Config)}.
post_end_per_testcase(TC,Config,Result,State) ->
{Result, end_tc(TC,Config, Result,State)}.
+on_tc_fail(_TC, _Res, State = #state{test_cases = []}) ->
+ State;
on_tc_fail(_TC, Res, State) ->
TCs = State#state.test_cases,
- TC = hd(State#state.test_cases),
- NewTC = TC#testcase{ failure =
- {fail,lists:flatten(io_lib:format("~p",[Res]))} },
+ TC = hd(TCs),
+ NewTC = TC#testcase{
+ failure =
+ {fail,lists:flatten(io_lib:format("~p",[Res]))} },
State#state{ test_cases = [NewTC | tl(TCs)]}.
+on_tc_skip(_Tc, _Res, State = #state{test_cases = []}) ->
+ State;
on_tc_skip(_Tc, Res, State) ->
TCs = State#state.test_cases,
- TC = hd(State#state.test_cases),
+ TC = hd(TCs),
NewTC = TC#testcase{
failure =
{skipped,lists:flatten(io_lib:format("~p",[Res]))} },