Enum
Last updated
mix test test/enum_test.exs
warning: Sender.email/1 is undefined (module Sender is not available or is yet to be defined)
test/sender_test.exs:8: EnumTest."test simple tests about Enum.each"/1
1) test simple tests about Enum.each (SenderTest)
test/enum_test.exs:4
** (UndefinedFunctionError) function Sender.email/1 is undefined (module Sender is not available)
code: Enum.each(my_list, fn email ->
stacktrace:
Sender.email("test@example.com")
test/enum_test.exs:8: anonymous fn/1 in SenderTest."test simple tests about Enum.each"/1
(elixir 1.14.3) lib/enum.ex:975: Enum."-each/2-lists^foreach/1-0-"/2
test/enum_test.exs:7: (test)
Finished in 0.08 seconds (0.00s async, 0.08s sync)
1 test, 1 failuredefmodule Sender do
def email(email), do: "Email sent to #{email}"
end
mix test test/enum_test.exs
Compiling 1 file (.ex)
Generated hello_world app
.
Finished in 0.04 seconds (0.00s async, 0.04s sync)
1 test, 0 failuresdefmodule EnumTest do
use ExUnit.Case
describe "Enum.map/2" do
test "simple tests about Enum.each" do
my_list = ["test@example.com", "another_test@example.com"]
expected_list = ["mailto:test@example.com", "mailto:another_test@example.com"]
new_list = Enum.map(my_list, fn email ->
"mailto:#{email}"
end)
assert new_list == expected_list
end
end
end
mix test test/enum_test.exs
..
Finished in 0.04 seconds (0.00s async, 0.04s sync)
2 tests, 0 failures