Use bare double underscores instead of atoms

This commit is contained in:
Uku Taht
2016-04-19 13:35:20 +01:00
parent 45619f6bdb
commit ea2bb8f9bf
14 changed files with 141 additions and 139 deletions

View File

@@ -4,12 +4,12 @@ defmodule Tasks do
koan "Tasks can be used for asynchronous computations with results" do
task = Task.async(fn -> 3 *3 end)
do_other_stuff()
assert Task.await(task) + 1 == :__
assert Task.await(task) + 1 == __
end
koan "If you don't need a result, use start_link/1" do
{result, _pid} = Task.start_link(fn -> 1+1 end)
assert result == :__
assert result == __
end
koan "Yield returns nothing if the task isn't done yet" do
@@ -17,7 +17,7 @@ defmodule Tasks do
:timer.sleep(100)
3 * 3
end)
assert Task.yield(handle, 10) == :__
assert Task.yield(handle, 10) == __
end
koan "Tasks can be aborted with shutdown" do
@@ -25,13 +25,13 @@ defmodule Tasks do
:timer.sleep(100)
3 * 3
end)
assert Task.shutdown(handle) == :__
assert Task.shutdown(handle) == __
end
koan "Shutdown will give you an answer if it has it" do
handle = Task.async(fn -> 3 * 3 end)
:timer.sleep(10)
assert Task.shutdown(handle) == {:ok, :__}
assert Task.shutdown(handle) == {:ok, __}
end
koan "You can yield to multiple tasks at once and extract the results" do
@@ -40,7 +40,7 @@ defmodule Tasks do
|> Task.yield_many(100)
|> Enum.map(fn({_task,{:ok, result}}) -> result end)
assert squares == :__
assert squares == __
end
def do_other_stuff do