gproc_pt_tests.erl 460 B

123456789101112131415161718192021222324
  1. -module(gproc_pt_tests).
  2. -include_lib("eunit/include/eunit.hrl").
  3. -compile({parse_transform, gproc_pt}).
  4. reg_and_send_test_() ->
  5. {setup,
  6. fun() -> application:start(gproc) end,
  7. fun(_) -> application:stop(gproc) end,
  8. [{"gproc", fun gproc/0}]
  9. }.
  10. gproc() ->
  11. gproc:reg({n, l, <<"test">>}),
  12. Msg = rand:uniform(1000),
  13. {n, l, <<"test">>} ! Msg,
  14. Echo = receive
  15. V -> V
  16. end,
  17. ?assertEqual(Echo, Msg).