Assert the results of all koans tests
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
ExUnit.start()
|
||||
|
||||
defmodule TestHarness do
|
||||
import ExUnit.Assertions
|
||||
|
||||
def test_all(module, answers) do
|
||||
module.all_koans
|
||||
|> check_answer_count(answers, module)
|
||||
|> Enum.zip(answers)
|
||||
|> run_all(module)
|
||||
|> check_results
|
||||
end
|
||||
|
||||
defp check_answer_count(koans, answers, module) do
|
||||
@@ -19,6 +22,10 @@ defmodule TestHarness do
|
||||
end
|
||||
end
|
||||
|
||||
defp check_results(results) do
|
||||
Enum.each results, &(assert &1 == :passed)
|
||||
end
|
||||
|
||||
def run_all(pairs, module) do
|
||||
Enum.map(pairs, fn ({koan, answer}) -> Execute.run_koan(module, koan, [answer]) end)
|
||||
end
|
||||
|
Reference in New Issue
Block a user