View Source Machete.MaybeMatcher (Machete v0.2.3)

Defines a matcher that matches against another matcher & also matches nil

Link to this section Summary

Types

t()

Describes an instance of this matcher

Functions

Matches against another matcher & also matches nil

Link to this section Types

@opaque t()

Describes an instance of this matcher

Link to this section Functions

@spec maybe(Machete.Matchable.t()) :: t()

Matches against another matcher & also matches nil

Takes another matcher as its sole (mandatory) argument

Examples:

iex> assert nil ~> maybe(string())
true

iex> assert "abc" ~> maybe(string())
true