Split koan with race condition into two more logical ones

This commit is contained in:
Sven Gehring
2017-03-22 10:38:42 +01:00
parent c9db06adc5
commit 2881c95c00
2 changed files with 13 additions and 1 deletions

View File

@@ -17,9 +17,20 @@ defmodule Processes do
assert is_pid(self()) == ___ assert is_pid(self()) == ___
end end
koan "New processes are spawned functions" do koan "Like our current process, new processes are spawned functions" do
pid = spawn(fn -> nil end) pid = spawn(fn -> nil end)
assert is_pid(pid) == ___
end
koan "Processes exit after executing their function, unless they wait for something" do
wait_forever = fn ->
receive do
end
end
pid = spawn(wait_forever)
assert Process.alive?(pid) == ___ assert Process.alive?(pid) == ___
end end

View File

@@ -8,6 +8,7 @@ defmodule ProcessesTests do
:running, :running,
true, true,
true, true,
true,
"hola!", "hola!",
{:multiple, ["hola!", "como se llama?"]}, {:multiple, ["hola!", "como se llama?"]},
:how_are_you?, :how_are_you?,