File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -376,13 +376,18 @@ defmodule ExUnit.Assertions do
376
376
377
377
@ doc """
378
378
Asserts the `exception` is raised during `function` execution with
379
- the `expected_message`. Returns the rescued exception, fails otherwise.
379
+ the expected `message`, which can be a `Regex` or an exact `String`.
380
+ Returns the rescued exception, fails otherwise.
380
381
381
382
## Examples
382
383
383
384
assert_raise ArithmeticError, "bad argument in arithmetic expression", fn ->
384
385
1 + "test"
385
386
end
387
+
388
+ assert_raise RuntimeError, ~r/^Today's lucky number is 0\. \d +!$/, fn ->
389
+ raise "Today's lucky number is #{ :random . uniform } !"
390
+ end
386
391
"""
387
392
def assert_raise ( exception , message , function ) when is_function ( function ) do
388
393
error = assert_raise ( exception , function )
You can’t perform that action at this time.
0 commit comments