@@ -184,16 +184,21 @@ defmodule ExUnit.DocTest do
184
184
instead: instead ] ,
185
185
stack
186
186
end
187
- rescue e ->
188
- location = [ line: unquote ( line ) , file: Path . relative_to ( unquote ( file ) , System . cwd! ) ]
189
- stack = [ { unquote ( module ) , :__MODULE__ , 0 , location } ]
190
- raise ExUnit.ExpectationError ,
191
- [ prelude: "Expected doctest" ,
192
- expected: unquote ( test . expr ) ,
193
- actual: "without an exception" ,
194
- reason: "complete" ,
195
- instead: e ] ,
196
- stack
187
+ rescue
188
+ e in [ ExUnit.ExpectationError ] ->
189
+ location = [ line: unquote ( line ) , file: Path . relative_to ( unquote ( file ) , System . cwd! ) ]
190
+ stack = [ { unquote ( module ) , :__MODULE__ , 0 , location } ]
191
+ raise e , [ ] , stack
192
+ e ->
193
+ location = [ line: unquote ( line ) , file: Path . relative_to ( unquote ( file ) , System . cwd! ) ]
194
+ stack = [ { unquote ( module ) , :__MODULE__ , 0 , location } ]
195
+ raise ExUnit.ExpectationError ,
196
+ [ prelude: "Expected doctest" ,
197
+ expected: unquote ( test . expr ) ,
198
+ actual: "without an exception" ,
199
+ reason: "complete" ,
200
+ instead: e ] ,
201
+ stack
197
202
end
198
203
end
199
204
if do_import do
0 commit comments