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
376376
377377 @ doc """
378378 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.
380381
381382 ## Examples
382383
383384 assert_raise ArithmeticError, "bad argument in arithmetic expression", fn ->
384385 1 + "test"
385386 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
386391 """
387392 def assert_raise ( exception , message , function ) when is_function ( function ) do
388393 error = assert_raise ( exception , function )
You can’t perform that action at this time.
0 commit comments