Croma.Defpt (croma v0.12.0)

View Source

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

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.

Functions

defpt(call, body \\ nil)

(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

use Croma

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