Remove koans illustrating self-exit
I don't really like these examples, because the process would exit anyway when the function returns... Also having to sleep is not ideal.
This commit is contained in:
@@ -53,12 +53,6 @@ defmodule Processes do
|
|||||||
assert_receive ___
|
assert_receive ___
|
||||||
end
|
end
|
||||||
|
|
||||||
koan "Killing a process will terminate it" do
|
|
||||||
pid = spawn(fn -> Process.exit(self, :kill) end)
|
|
||||||
:timer.sleep(500)
|
|
||||||
assert Process.alive?(pid) == ___
|
|
||||||
end
|
|
||||||
|
|
||||||
koan "You can also terminate processes other than yourself" do
|
koan "You can also terminate processes other than yourself" do
|
||||||
pid = spawn(fn -> receive do end end)
|
pid = spawn(fn -> receive do end end)
|
||||||
|
|
||||||
@@ -93,13 +87,6 @@ defmodule Processes do
|
|||||||
assert Process.alive?(pid) == ___
|
assert Process.alive?(pid) == ___
|
||||||
end
|
end
|
||||||
|
|
||||||
koan "Exiting normally yourself on the other hand DOES terminate you" do
|
|
||||||
pid = spawn(fn -> Process.exit(self, :normal) end)
|
|
||||||
:timer.sleep(100)
|
|
||||||
|
|
||||||
assert Process.alive?(pid) == ___
|
|
||||||
end
|
|
||||||
|
|
||||||
koan "Parent processes can trap exits for children they are linked to" do
|
koan "Parent processes can trap exits for children they are linked to" do
|
||||||
Process.flag(:trap_exit, true)
|
Process.flag(:trap_exit, true)
|
||||||
spawn_link(fn -> Process.exit(self, :normal) end)
|
spawn_link(fn -> Process.exit(self, :normal) end)
|
||||||
|
|||||||
@@ -11,11 +11,9 @@ defmodule ProcessesTests do
|
|||||||
"hola!",
|
"hola!",
|
||||||
:how_are_you?,
|
:how_are_you?,
|
||||||
{:waited_too_long, "I am impatient"},
|
{:waited_too_long, "I am impatient"},
|
||||||
false,
|
|
||||||
{:multiple, [true, false]},
|
{:multiple, [true, false]},
|
||||||
{:exited, :random_reason},
|
{:exited, :random_reason},
|
||||||
true,
|
true,
|
||||||
false,
|
|
||||||
:normal,
|
:normal,
|
||||||
:normal,
|
:normal,
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user