Skip to content

Commit db93099

Browse files
committed
Use multiline failure message for asser_raise/3
Before this commit, `assert_raise/3` in ExUnit used an uncomfortable failure message when the expected exception message and the real one didn't match: they were both written on the same line, which caused problems for long-ish messages. Now, each exception message is printed on its own line, which should make it clearer to spot differences and cleaner in general.
1 parent d76cc95 commit db93099

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/ex_unit/lib/ex_unit/assertions.ex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,11 @@ defmodule ExUnit.Assertions do
392392
Regex.regex?(message) -> Exception.message(error) =~ message
393393
end
394394

395-
msg = "Wrong message for #{inspect exception}. " <>
396-
"Expected #{inspect message}, got #{inspect Exception.message(error)}"
395+
msg = "Wrong message for #{inspect exception}\n" <>
396+
"Expected:\n" <>
397+
" #{inspect message}\n" <>
398+
"Got:\n" <>
399+
" #{inspect Exception.message(error)}"
397400
assert is_match, message: msg
398401

399402
error

0 commit comments

Comments
 (0)