two_fer pasing without comments

This commit is contained in:
Ruidy 2022-01-31 09:44:22 -04:00
parent d0f60e4a91
commit fc3da6bb39
2 changed files with 5 additions and 7 deletions

View file

@ -1,8 +1,11 @@
defmodule TwoFer do defmodule TwoFer do
@moduledoc """
`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
"""
@doc """ @doc """
Two-fer or 2-fer is short for two for one. One for you and one for me. Two-fer or 2-fer is short for two for one. One for you and one for me.
""" """
@spec two_fer(String.t()) :: String.t() @spec two_fer(String.t()) :: String.t()
def two_fer(name) do def two_fer(name \\ "you") when is_bitstring(name), do: "One for #{name}, one for me."
end
end end

View file

@ -5,31 +5,26 @@ defmodule TwoFerTest do
assert TwoFer.two_fer() == "One for you, one for me." assert TwoFer.two_fer() == "One for you, one for me."
end end
@tag :pending
test "a name given" do test "a name given" do
assert TwoFer.two_fer("Alice") == "One for Alice, one for me." assert TwoFer.two_fer("Alice") == "One for Alice, one for me."
end end
@tag :pending
test "another name given" do test "another name given" do
assert TwoFer.two_fer("Bob") == "One for Bob, one for me." assert TwoFer.two_fer("Bob") == "One for Bob, one for me."
end end
@tag :pending
test "when the parameter is a number" do test "when the parameter is a number" do
assert_raise FunctionClauseError, fn -> assert_raise FunctionClauseError, fn ->
TwoFer.two_fer(10) TwoFer.two_fer(10)
end end
end end
@tag :pending
test "when the parameter is an atom" do test "when the parameter is an atom" do
assert_raise FunctionClauseError, fn -> assert_raise FunctionClauseError, fn ->
TwoFer.two_fer(:bob) TwoFer.two_fer(:bob)
end end
end end
@tag :pending
test "when the parameter is a charlist" do test "when the parameter is a charlist" do
assert_raise FunctionClauseError, fn -> assert_raise FunctionClauseError, fn ->
refute TwoFer.two_fer('Jon Snow') refute TwoFer.two_fer('Jon Snow')