Croma.Defpt

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

Source

Summary

defpt(call, body \\ nil)

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

Macros

defpt(call, body \\ nil)

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
Source