@@ -167,7 +167,7 @@ defmodule ExUnit.DocTest do
167167 :"test doc at #{ inspect m } .#{ f } /#{ a } (#{ n } )"
168168 end
169169
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
171171 file = module . __info__ ( :compile ) [ :source ]
172172 location = [ line: line , file: Path . relative_to ( file , System . cwd! ) ]
173173 stack = Macro . escape [ { module , :__MODULE__ , 0 , location } ]
@@ -179,11 +179,11 @@ defmodule ExUnit.DocTest do
179179
180180 exceptions_num = Enum . count exprs , exc_filter_fn
181181 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 } " ]
187187 end
188188
189189 { tests , whole_expr } = Enum . map_reduce exprs , "" , fn { expr , expected } , acc ->
0 commit comments