View Source Machete.MaybeMatcher (Machete v0.3.0)

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

Summary

Types

t()

Describes an instance of this matcher

Functions

Matches against another matcher & also matches nil

Types

@opaque t()

Describes an instance of this matcher

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