Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 70c89a8204
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (32 sloc) 1.079 kb
-module(ping_test).
-compile(export_all).
setup() ->
application:start(gproc),
meck:new(chronos, [passthrough]),
meck:expect(chronos, start_timer,
fun(_,_,_,_) ->
0
end).
start_test() ->
{ok, _Pid} = ping:start_link(),
true = meck:called(chronos, start_link, '_').
ping_timer_started_test() ->
true = meck:called(chronos, start_timer,%% '_').
['_', '_',
1000,
{ping, timer_expiry, [ping_timer]}]).
expire_ping_timer_test() ->
ping:timer_expiry(ping_timer),
true = meck:called(chronos, start_timer, ['_', '_',
30000,
{ping, timer_expiry, [silence_timer]}]).
expire_silence_timer_test() ->
ping:timer_expiry(silence_timer),
timer:sleep(100),
undefined = whereis(ping).
run_test() ->
setup(),
start_test(),
ping_timer_started_test(),
expire_ping_timer_test(),
expire_silence_timer_test().
Jump to Line
Something went wrong with that request. Please try again.