|
@@ -41,6 +41,9 @@ dist_test_() ->
|
|
|
?debugVal(t_simple_reg(Ns))
|
|
|
end,
|
|
|
fun() ->
|
|
|
+ ?debugVal(t_mreg(Ns))
|
|
|
+ end,
|
|
|
+ fun() ->
|
|
|
?debugVal(t_await_reg(Ns))
|
|
|
end,
|
|
|
fun() ->
|
|
@@ -59,6 +62,7 @@ dist_test_() ->
|
|
|
}]}.
|
|
|
|
|
|
-define(T_NAME, {n, g, {?MODULE, ?LINE}}).
|
|
|
+-define(T_KVL, [{foo, "foo"}, {bar, "bar"}]).
|
|
|
|
|
|
t_simple_reg([H|_] = Ns) ->
|
|
|
Name = ?T_NAME,
|
|
@@ -68,6 +72,11 @@ t_simple_reg([H|_] = Ns) ->
|
|
|
?assertMatch(ok, t_lookup_everywhere(Name, Ns, undefined)),
|
|
|
?assertMatch(ok, t_call(P, die)).
|
|
|
|
|
|
+t_mreg([H|_] = Ns) ->
|
|
|
+ Kvl = ?T_KVL,
|
|
|
+ P = t_spawn_mreg(H, Kvl),
|
|
|
+ ?assertMatch(ok, t_call(P, die)).
|
|
|
+
|
|
|
t_await_reg([A,B|_]) ->
|
|
|
Name = ?T_NAME,
|
|
|
P = t_spawn(A),
|
|
@@ -173,6 +182,17 @@ t_spawn_reg(Node, Name) ->
|
|
|
{P, ok} -> P
|
|
|
end.
|
|
|
|
|
|
+t_spawn_mreg(Node, KVL) ->
|
|
|
+ Me = self(),
|
|
|
+ spawn(Node, fun() ->
|
|
|
+ ?assertMatch(true, gproc:mreg(p, g, KVL)),
|
|
|
+ Me ! {self(), ok},
|
|
|
+ t_loop()
|
|
|
+ end),
|
|
|
+ receive
|
|
|
+ {P, ok} -> P
|
|
|
+ end.
|
|
|
+
|
|
|
t_call(P, Req) ->
|
|
|
Ref = erlang:monitor(process, P),
|
|
|
P ! {self(), Ref, Req},
|