diff options
author | Hans Bolinder <[email protected]> | 2016-02-03 15:33:11 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-02-17 09:17:33 +0100 |
commit | 7113a52be93505b2db99cfa7a37160e80722a203 (patch) | |
tree | ebf6722bc00691811a003e2f77d7bda53cab78ad /lib/eunit/src/eunit_listener.erl | |
parent | 98f74d1f6f1109cbd0cbc495ed3d8630271ce8c6 (diff) | |
download | otp-7113a52be93505b2db99cfa7a37160e80722a203.tar.gz otp-7113a52be93505b2db99cfa7a37160e80722a203.tar.bz2 otp-7113a52be93505b2db99cfa7a37160e80722a203.zip |
eunit: Add suppression of Dialyzer warnings
Diffstat (limited to 'lib/eunit/src/eunit_listener.erl')
-rw-r--r-- | lib/eunit/src/eunit_listener.erl | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/eunit/src/eunit_listener.erl b/lib/eunit/src/eunit_listener.erl index ecaac424a2..d9b836863b 100644 --- a/lib/eunit/src/eunit_listener.erl +++ b/lib/eunit/src/eunit_listener.erl @@ -27,14 +27,11 @@ -export([start/1, start/2]). --export([behaviour_info/1]). - - -behaviour_info(callbacks) -> - [{init,1},{handle_begin,3},{handle_end,3},{handle_cancel,3}, - {terminate,2}]; -behaviour_info(_Other) -> - undefined. +-callback init(_) -> _. +-callback handle_begin(_, _, _) -> _. +-callback handle_end(_, _, _) -> _. +-callback handle_cancel(_, _, _) -> _. +-callback terminate(_, _) -> _. -record(state, {callback, % callback module @@ -50,18 +47,22 @@ start(Callback) -> start(Callback, Options) -> St = #state{callback = Callback}, - spawn_opt(fun () -> init(St, Options) end, + spawn_opt(init_fun(St, Options), proplists:get_all_values(spawn, Options)). -init(St0, Options) -> - St1 = call(init, [Options], St0), - St2 = expect([], undefined, St1), - Data = [{pass, St2#state.pass}, - {fail, St2#state.fail}, - {skip, St2#state.skip}, - {cancel, St2#state.cancel}], - call(terminate, [{ok, Data}, St2#state.state], St2), - exit(normal). +-spec init_fun(_, _) -> no_return(). + +init_fun(St0, Options) -> + fun () -> + St1 = call(init, [Options], St0), + St2 = expect([], undefined, St1), + Data = [{pass, St2#state.pass}, + {fail, St2#state.fail}, + {skip, St2#state.skip}, + {cancel, St2#state.cancel}], + call(terminate, [{ok, Data}, St2#state.state], St2), + exit(normal) + end. expect(Id, ParentId, St) -> case wait_for(Id, 'begin', ParentId) of |