To improve testing, add a layer of indirection around colours.
This commit is contained in:
@@ -5,13 +5,13 @@ defmodule FailureTests do
|
||||
test "assertion failure with proper expression" do
|
||||
error = error(%ExUnit.AssertionError{expr: "hi"})
|
||||
|
||||
assert Failure.format_failure(error) == "\e[36mAssertion failed in some_file.ex:42\e[0m\n\e[31m\"hi\"\e[0m\n"
|
||||
assert Failure.format_failure(error) == "Assertion failed in some_file.ex:42\n\"hi\"\n"
|
||||
end
|
||||
|
||||
test "assertion failure with message" do
|
||||
error = error(%ExUnit.AssertionError{expr: :ex_unit_no_meaningful_value, message: "hola"})
|
||||
|
||||
assert Failure.format_failure(error) == "\e[36mAssertion failed in some_file.ex:42\e[0m\n\e[31mhola\e[0m\n"
|
||||
assert Failure.format_failure(error) == "Assertion failed in some_file.ex:42\nhola\n"
|
||||
end
|
||||
|
||||
defp error(error) do
|
||||
|
||||
@@ -4,6 +4,6 @@ defmodule NotificationTest do
|
||||
|
||||
test "shows possible koans when a koan can not be found" do
|
||||
message = Notifications.invalid_koan(SampleKoan, [PassingKoan])
|
||||
assert message == "Did not find koan SampleKoan in \e[31mPassingKoan\e[0m"
|
||||
assert message == "Did not find koan SampleKoan in PassingKoan"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user