Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 17633e7061
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (31 sloc) 0.987 kB
-module(pubsub_pipes_tests).
-include_lib("eunit/include/eunit.hrl").
pipe_test_() ->
{foreach,
fun setup/0,
fun cleanup/1,
[
fun create_pipe/0,
fun register_on_pipe/0,
fun deregister_from_pipe/0
]}.
setup() ->
pubsub_pipes:start_link().
cleanup(_) ->
pubsub_pipes:stop().
create_pipe() ->
PipeName = "A",
ok = pubsub_pipes:new_pipe(PipeName),
?assertEqual([PipeName],pubsub_pipes:get_pipes()).
register_on_pipe() ->
PipeName = "A",
Self = self(),
ok = pubsub_pipes:new_pipe(PipeName),
ok = pubsub_pipes:subscribe_to_pipe(PipeName),
?assertEqual([Self],pubsub_pipes:get_subscribers_to_pipe(PipeName)).
deregister_from_pipe() ->
PipeName = "A",
ok = pubsub_pipes:new_pipe(PipeName),
ok = pubsub_pipes:subscribe_to_pipe(PipeName),
ok = pubsub_pipes:unsubscribe_from_pipe(PipeName),
?assertEqual([],pubsub_pipes:get_subscribers_to_pipe(PipeName)).
Jump to Line
Something went wrong with that request. Please try again.