From f797ca8e80d438271150ee3a37756e31ef8c1768 Mon Sep 17 00:00:00 2001 From: Felipe Sere Date: Fri, 23 Dec 2016 23:53:41 +0100 Subject: [PATCH 1/2] Test for single arity failures --- test/display/failure_test.exs | 9 +++++++++ test/support/single_arity_koan.ex | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 test/support/single_arity_koan.ex diff --git a/test/display/failure_test.exs b/test/display/failure_test.exs index 4f9cea3..c88e920 100644 --- a/test/display/failure_test.exs +++ b/test/display/failure_test.exs @@ -37,6 +37,15 @@ defmodule FailureTests do """ end + test "single arity failure" 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, diff --git a/test/support/single_arity_koan.ex b/test/support/single_arity_koan.ex new file mode 100644 index 0000000..0fe5aa5 --- /dev/null +++ b/test/support/single_arity_koan.ex @@ -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 From 8860a52b9849c8f83194ca6683197cc7997cc0e9 Mon Sep 17 00:00:00 2001 From: Felipe Sere Date: Tue, 10 Jan 2017 09:30:44 +0000 Subject: [PATCH 2/2] Better phrase the test that forces do-block unwrapping See https://github.com/elixirkoans/elixir-koans/issues/151 for more details. --- test/display/failure_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/display/failure_test.exs b/test/display/failure_test.exs index c88e920..1962d6e 100644 --- a/test/display/failure_test.exs +++ b/test/display/failure_test.exs @@ -37,7 +37,7 @@ defmodule FailureTests do """ end - test "single arity failure" do + test "only offending lines are displayed for errors" do [koan] = SingleArity.all_koans error = apply(SingleArity, koan, []) |> error()