View Source Croma.Defpt (croma v0.11.3)

Module that provides Croma.Defpt.defpt/2 macro.

Link to this section Summary

Functions

Defines a unit-testable private function. When Mix.env() == :test, defpt defines a public function and thus it can be freely called from tests. Otherwise functions defined by defpt become private. Usage of this macro is exactly the same as the standard def and defp macros.

Link to this section Functions

Link to this macro

defpt(call, body \\ nil)

View Source (macro)

Defines a unit-testable private function. When Mix.env() == :test, defpt defines a public function and thus it can be freely called from tests. Otherwise functions defined by defpt become private. Usage of this macro is exactly the same as the standard def and defp macros.

example

Example

use Croma

defmodule M do
  defpt f(x) do
    IO.inspect(x)
  end
end