test_match v1.0.0 RecursiveMatch behaviour
Recursive matching
Link to this section Summary
Link to this section Types
Link to this section Functions
Link to this function
match_r(pattern, tested, options \\ [exactly: true])
Link to this section Callbacks
Recursive matches given value with pattern
Returns true
or raises ExUnit.AssertionError
Parameters
pattern: Expected pattern
tested: Tested value
opts:
exactly: when
true
compare using===
, whenfalse
compare using==
message: Custom message on faile
Example
The assertion
assert_match %{a: 1}, %{a: 1, b: 2}
will match,
assert_match %{a: 1, b: 2}, %{a: 1}
will fail with the message:
match (assert_match) failed
left: %{a: 1, b: 2},
right: %{a: 1}
Recursive matches given value with pattern
Returns true
or raises ExUnit.AssertionError
Parameters
pattern: Expected pattern
tested: Tested value
opts:
exactly: when
true
compare using===
, whenfalse
compare using==
message: Custom message on faile
Example
The assertion
assert_match %{a: 1}, %{a: 1, b: 2}
will match,
assert_match %{a: 1, b: 2}, %{a: 1}
will fail with the message:
match (refute_match) succeeded, but should have failed