View Source Machete.IsAMatcher (Machete v0.3.0)

Defines a matcher that matches againt a type of struct

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.

Types

@opaque t()

Describes an instance of this matcher

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