Guards
defmodule PrinterTest do
use ExUnit.Case
test "print/1" do
assert Printer.print(1) == "Number: 1"
assert Printer.print("Hello") == "Text: Hello"
assert Printer.print(%{name: "iago"}) == "Map with name: iago"
end
end
mix test test/printer_test.exs
Compiling 1 file (.ex)
Generated hello_world app
warning: Printer.print/1 is undefined (module Printer is not available or is yet to be defined)
Invalid call found at 3 locations:
test/printer_test.exs:5: PrinterTest."test print/1"/1
test/printer_test.exs:6: PrinterTest."test print/1"/1
test/printer_test.exs:7: PrinterTest."test print/1"/1
1) test print/1 (PrinterTest)
test/printer_test.exs:4
** (UndefinedFunctionError) function Printer.print/1 is undefined (module Printer is not available)
code: assert Printer.print(1) == "Number: 1"
stacktrace:
Printer.print(1)
test/printer_test.exs:5: (test)
Finished in 0.02 seconds (0.00s async, 0.02s sync)
1 test, 1 failureLimitaƧƵes
Last updated