mirror of
https://github.com/rjNemo/exercism-elixir
synced 2026-06-06 10:26:48 +00:00
33 lines
736 B
Elixir
33 lines
736 B
Elixir
defmodule TwoFerTest do
|
|
use ExUnit.Case
|
|
|
|
test "no name given" do
|
|
assert TwoFer.two_fer() == "One for you, one for me."
|
|
end
|
|
|
|
test "a name given" do
|
|
assert TwoFer.two_fer("Alice") == "One for Alice, one for me."
|
|
end
|
|
|
|
test "another name given" do
|
|
assert TwoFer.two_fer("Bob") == "One for Bob, one for me."
|
|
end
|
|
|
|
test "when the parameter is a number" do
|
|
assert_raise FunctionClauseError, fn ->
|
|
TwoFer.two_fer(10)
|
|
end
|
|
end
|
|
|
|
test "when the parameter is an atom" do
|
|
assert_raise FunctionClauseError, fn ->
|
|
TwoFer.two_fer(:bob)
|
|
end
|
|
end
|
|
|
|
test "when the parameter is a charlist" do
|
|
assert_raise FunctionClauseError, fn ->
|
|
refute TwoFer.two_fer('Jon Snow')
|
|
end
|
|
end
|
|
end
|