@@ -167,7 +167,7 @@ defmodule ExUnit.DocTest do
167
167
:"test doc at #{ inspect m } .#{ f } /#{ a } (#{ n } )"
168
168
end
169
169
170
- defp test_content ( Test [ exprs : exprs , line: line ] , module , do_import ) do
170
+ defp test_content ( Test [ exprs : exprs , line: line , fun_arity: fun_arity ] , module , do_import ) do
171
171
file = module . __info__ ( :compile ) [ :source ]
172
172
location = [ line: line , file: Path . relative_to ( file , System . cwd! ) ]
173
173
stack = Macro . escape [ { module , :__MODULE__ , 0 , location } ]
@@ -179,11 +179,11 @@ defmodule ExUnit.DocTest do
179
179
180
180
exceptions_num = Enum . count exprs , exc_filter_fn
181
181
if exceptions_num > 1 do
182
- # FIXME: stacktrace pointing to the doctest?
183
- raise Error , [ message: "Multiple exceptions in one doctest case are not supported" ]
184
-
185
- # this doesn't work :( nothing is raised
186
- # raise Error[message: "Multiple exceptions in one doctest case are not supported"], [], stack
182
+ # Format the info about error location as if it were a part of the
183
+ # stacktrace
184
+ { fun , arity } = fun_arity
185
+ error_info = " #{ file } : #{ line } : #{ inspect module } . #{ fun } / #{ arity } "
186
+ raise Error , [ message: "Multiple exceptions in one doctest case are not supported. \n #{ error_info } " ]
187
187
end
188
188
189
189
{ tests , whole_expr } = Enum . map_reduce exprs , "" , fn { expr , expected } , acc ->
0 commit comments