View Source ExUnitExt.Theme behaviour (ExUnitExt v0.1.0-alpha.0)

The default theme for ExUnitExt.

Summary

Callbacks

Returns the colors map used to format the output.

Returns a boolean indicating if the theme is enabled.

Called by the formatter to print events.

Returns the signs map used to show the results.

Functions

Returns a map with default colors merged with the custom colors in opts.

Returns a theme module for the given name or the default theme.

The default print function for ExUnitExt.Theme.

Returns a printer function for the given theme in opts.

Returns a map with default signs merged with the custom signs in opts.

Callbacks

colors(opts)

@callback colors(opts :: keyword()) :: map()

Returns the colors map used to format the output.

enabled?()

@callback enabled?() :: boolean()

Returns a boolean indicating if the theme is enabled.

The default implementation returns IO.ANSI.enabled?(). If a theme not enabled the default theme is used.

print(event, config)

@callback print(event :: atom() | tuple(), config :: map()) :: :ok

Called by the formatter to print events.

signs(opts)

@callback signs(opts :: keyword()) :: map()

Returns the signs map used to show the results.

Functions

color_doc(escape, doc, config)

@spec color_doc(Escape.ansicode(), Inspect.Algebra.t(), map()) :: Inspect.Algebra.t()

colors(opts)

@spec colors(opts :: keyword()) :: map()

Returns a map with default colors merged with the custom colors in opts.

format(ansi, config)

@spec format(Escape.ansidata(), map()) :: String.t()

format_us(us)

@spec format_us(us :: integer()) :: String.t()

get(name)

@spec get(String.t() | nil) :: module()

Returns a theme module for the given name or the default theme.

If the name can not be found the default theme is returned and a warning is printed.

indent(output, indent \\ 1)

@spec indent(String.t() | list(), non_neg_integer()) :: String.t()

normalize_us(us)

@spec normalize_us(us :: integer()) :: integer()

pluralize(arg1, singular)

@spec pluralize(count :: integer(), singular :: String.t()) :: String.t()

pluralize(arg1, singular, plural)

@spec pluralize(count :: integer(), singular :: String.t(), plural :: String.t()) ::
  String.t()

print(arg1, config)

@spec print(event :: atom() | tuple(), config :: map()) :: :ok

The default print function for ExUnitExt.Theme.

printer(opts)

@spec printer(opts :: keyword()) :: (event :: atom() | tuple() -> :ok)

Returns a printer function for the given theme in opts.

If no theme can be found the default theme is used.

puts(ansi, config)

@spec puts(Escape.ansidata(), map()) :: :ok

signs(opts, default \\ %{failure: "!", invalid: "?", skipped: "*", success: "."})

@spec signs(opts :: keyword(), map()) :: map()

Returns a map with default signs merged with the custom signs in opts.

write(ansi, config)

@spec write(Escape.ansidata(), map()) :: :ok