Remove parens from self

In my experience, the parens in this case are not idiomatic.
This commit is contained in:
Jay Hayes
2016-05-02 12:53:12 -05:00
parent 74b99676e7
commit b184de5817

View File

@@ -2,11 +2,11 @@ defmodule Processes do
use Koans use Koans
koan "You are a process" do koan "You are a process" do
assert Process.alive?(self()) == ___ assert Process.alive?(self) == ___
end end
koan "You can ask a process to introduce itself" do koan "You can ask a process to introduce itself" do
information = Process.info(self()) information = Process.info(self)
assert information[:status] == ___ assert information[:status] == ___
end end
@@ -18,7 +18,7 @@ defmodule Processes do
end end
koan "You can send messages to processes" do koan "You can send messages to processes" do
send self(), "hola!" send self, "hola!"
receive do receive do
msg -> assert msg == ___ msg -> assert msg == ___
@@ -31,12 +31,12 @@ defmodule Processes do
end end
end) end)
send pid, {:hello, self()} send pid, {:hello, self}
assert_receive ___ assert_receive ___
end end
koan "Waiting for a message can get boring" do koan "Waiting for a message can get boring" do
parent = self() parent = self
spawn(fn -> receive do spawn(fn -> receive do
after after
5 -> send parent, {:waited_too_long, "I am impatient"} 5 -> send parent, {:waited_too_long, "I am impatient"}
@@ -47,7 +47,7 @@ defmodule Processes do
end end
koan "Killing a process will terminate it" do koan "Killing a process will terminate it" do
pid = spawn(fn -> Process.exit(self(), :kill) end) pid = spawn(fn -> Process.exit(self, :kill) end)
:timer.sleep(500) :timer.sleep(500)
assert Process.alive?(pid) == ___ assert Process.alive?(pid) == ___
end end
@@ -61,7 +61,7 @@ defmodule Processes do
end end
koan "Trapping will allow you to react to someone terminating the process" do koan "Trapping will allow you to react to someone terminating the process" do
parent = self() parent = self
pid = spawn(fn -> pid = spawn(fn ->
Process.flag(:trap_exit, true) Process.flag(:trap_exit, true)
send parent, :ready send parent, :ready
@@ -101,7 +101,7 @@ defmodule Processes do
end end
koan "If you monitor your children, you'll be automatically informed for their depature" do koan "If you monitor your children, you'll be automatically informed for their depature" do
spawn_monitor(fn -> Process.exit(self(), :normal) end) spawn_monitor(fn -> Process.exit(self, :normal) end)
assert_receive {:DOWN, _ref, :process, _pid, ___} assert_receive {:DOWN, _ref, :process, _pid, ___}
end end