blob: 1788dd3d97c402487c854013533c37558c4cbd27 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
defmodule ExIRC.ClientTest do
use ExUnit.Case
test "start multiple clients" do
assert {:ok, pid} = ExIRC.start_client!
assert {:ok, pid2} = ExIRC.start_client!
assert pid != pid2
end
test "client dies if owner process dies" do
test_pid = self()
pid = spawn_link(fn ->
assert {:ok, pid} = ExIRC.start_client!
send(test_pid, {:client, pid})
receive do
:stop -> :ok
end
end)
client_pid = receive do
{:client, pid} -> pid
end
assert Process.alive?(client_pid)
send(pid, :stop)
:timer.sleep(1)
refute Process.alive?(client_pid)
end
end
|