|
44 | 44 | test_whereis_nonexistent/1, |
45 | 45 | test_whereis_with_atom/1, |
46 | 46 | test_whereis_with_bytes/1, |
47 | | - test_whereis_invalid_type/1 |
| 47 | + test_whereis_invalid_type/1, |
| 48 | + test_whereis_and_send/1 |
48 | 49 | ]). |
49 | 50 |
|
50 | 51 | all() -> |
@@ -75,7 +76,8 @@ all() -> |
75 | 76 | test_whereis_nonexistent, |
76 | 77 | test_whereis_with_atom, |
77 | 78 | test_whereis_with_bytes, |
78 | | - test_whereis_invalid_type |
| 79 | + test_whereis_invalid_type, |
| 80 | + test_whereis_and_send |
79 | 81 | ]. |
80 | 82 |
|
81 | 83 | init_per_suite(Config) -> |
@@ -346,6 +348,25 @@ test_whereis_invalid_type(_Config) -> |
346 | 348 | {error, {'TypeError', _}} = py:eval(<<"erlang.whereis(123)">>), |
347 | 349 | ok. |
348 | 350 |
|
| 351 | +%% @doc Test looking up a process with whereis and sending a message to it. |
| 352 | +test_whereis_and_send(_Config) -> |
| 353 | + Self = self(), |
| 354 | + erlang:register(py_whereis_send_test, Self), |
| 355 | + try |
| 356 | + %% Use Python helper to look up process and send message |
| 357 | + {ok, true} = py:call(py_test_pid_send, whereis_and_send, |
| 358 | + [<<"py_whereis_send_test">>, {<<"hello_from_whereis">>, 42}]), |
| 359 | + %% Verify we received the message |
| 360 | + receive |
| 361 | + {<<"hello_from_whereis">>, 42} -> ok |
| 362 | + after 5000 -> |
| 363 | + ct:fail(timeout_waiting_for_message) |
| 364 | + end |
| 365 | + after |
| 366 | + erlang:unregister(py_whereis_send_test) |
| 367 | + end, |
| 368 | + ok. |
| 369 | + |
349 | 370 | %%% ============================================================================ |
350 | 371 | %%% Helper Functions |
351 | 372 | %%% ============================================================================ |
|
0 commit comments