Merge pull request #154 from elixirkoans/enforce-the-do-block-in-koans

Test for single arity failures
This commit is contained in:
Jay Hayes
2017-01-10 08:59:24 -06:00
committed by GitHub
2 changed files with 20 additions and 0 deletions

View File

@@ -37,6 +37,15 @@ defmodule FailureTests do
"""
end
test "only offending lines are displayed for errors" do
[koan] = SingleArity.all_koans
error = apply(SingleArity, koan, []) |> error()
assert Failure.format_failure(error) == """
Assertion failed in some_file.ex:42\nmatch?(:foo, ___)
"""
end
defp error(error) do
%{
error: error,

View File

@@ -0,0 +1,11 @@
defmodule SingleArity do
use Koans
@intro """
A koan with single arity testing
"""
koan "Only one" do
assert match?(:foo, ___)
end
end