View Source Machete.IsAMatcher (Machete v0.2.3)

Defines a matcher that matches againt a type of struct

Link to this section Summary

Types

t()

Describes an instance of this matcher

Functions

Matches against a type of struct. Similar to Kernel.struct/2, the argument may be a module name or a struct instance. In both cases, the match is concerned solely with type equivalence.

Link to this section Types

@opaque t()

Describes an instance of this matcher

Link to this section Functions

@spec is_a(module() | struct()) :: t()

Matches against a type of struct. Similar to Kernel.struct/2, the argument may be a module name or a struct instance. In both cases, the match is concerned solely with type equivalence.

Examples:

iex> assert %URI{} ~> is_a(URI)
true

iex> assert %URI{} ~> is_a(%URI{})
true

iex> refute %URI{} ~> is_a(DateTime)
false