Skip to content

Commit

Permalink
add Cache test helper functions p.283 #1
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Aug 11, 2019
1 parent a403e89 commit d6c262b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/info_sys/test/cache_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,20 @@ defmodule InfoSysTest.CacheTest do
assert Cache.fetch(name, :notexists) == :error
end

defp assert_shutdown(pid) do
ref = Process.monitor(pid)
Process.unlink(pid)
Process.exit(pid, :kill)

assert_receive {:DOWN, ^ref, :process, ^pid, :killed}
end

defp eventually(func) do
if func.() do
true
else
Process.sleep(10)
eventually(func)
end
end
end

0 comments on commit d6c262b

Please sign in to comment.