@@ -34,6 +34,14 @@ start() ->
3434
3535test_node_no_distribution () ->
3636 nonode@nohost = node (),
37+ nonode@nohost = node (self ()),
38+ nonode@nohost = node (make_ref ()),
39+ nonode@nohost = node (external_port (nonode@nohost , 0 )),
40+ ok = assert_badarg (fun () -> node (test ) end ),
41+ ok = assert_badarg (fun () -> node ({test , nonode@nohost }) end ),
42+ test@test_node = node (external_pid ()),
43+ test@test_node = node (external_ref ()),
44+ test@test_node = node (external_port (test@test_node , 101 )),
3745 ok .
3846
3947test_node_distribution () ->
@@ -49,6 +57,9 @@ test_node_distribution() ->
4957 true = erlang :setnode (test@test_node , 42 ),
5058 42 = get_creation (),
5159 test@test_node = node (),
60+ test@test_node = node (self ()),
61+ test@test_node = node (make_ref ()),
62+ test@test_node = node (external_port (test@test_node , 42 )),
5263 NetKernelPid ! quit ,
5364 ok =
5465 receive
@@ -83,6 +94,33 @@ get_creation() ->
8394 erts_internal :get_creation ()
8495 end .
8596
97+ external_pid () ->
98+ binary_to_term (
99+ <<131 , 88 , 119 , 14 , " test@test_node" , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 42 >>
100+ ).
101+
102+ external_ref () ->
103+ binary_to_term (
104+ <<131 , 90 , 0 , 1 , 119 , 14 , " test@test_node" , 42 :32 , 1 :32 >>
105+ ).
106+
107+ external_port (Node , Creation ) ->
108+ term_from_node (Node , fun (NodeBin ) ->
109+ binary_to_term (<<131 , 120 , NodeBin /binary , 43 :64 , Creation :32 >>)
110+ end ).
111+
112+ term_from_node (Node , Fun ) ->
113+ NodeBin = atom_to_binary (Node , utf8 ),
114+ Fun (<<119 , (byte_size (NodeBin )), NodeBin /binary >>).
115+
116+ assert_badarg (Fun ) ->
117+ try
118+ Fun (),
119+ unexpected_success
120+ catch
121+ error :badarg -> ok
122+ end .
123+
86124sleep (Ms ) ->
87125 receive
88126 after Ms -> ok
0 commit comments