two_fer
This commit is contained in:
2
elixir/two-fer/test/test_helper.exs
Normal file
2
elixir/two-fer/test/test_helper.exs
Normal file
@@ -0,0 +1,2 @@
|
||||
ExUnit.start()
|
||||
ExUnit.configure(exclude: :pending, trace: true)
|
||||
38
elixir/two-fer/test/two_fer_test.exs
Normal file
38
elixir/two-fer/test/two_fer_test.exs
Normal file
@@ -0,0 +1,38 @@
|
||||
defmodule TwoFerTest do
|
||||
use ExUnit.Case
|
||||
|
||||
test "no name given" do
|
||||
assert TwoFer.two_fer() == "One for you, one for me."
|
||||
end
|
||||
|
||||
# @tag :pending
|
||||
test "a name given" do
|
||||
assert TwoFer.two_fer("Alice") == "One for Alice, one for me."
|
||||
end
|
||||
|
||||
# @tag :pending
|
||||
test "another name given" do
|
||||
assert TwoFer.two_fer("Bob") == "One for Bob, one for me."
|
||||
end
|
||||
|
||||
# @tag :pending
|
||||
test "when the argument is a number" do
|
||||
assert_raise FunctionClauseError, fn ->
|
||||
TwoFer.two_fer(10)
|
||||
end
|
||||
end
|
||||
|
||||
# @tag :pending
|
||||
test "when the argument is an atom" do
|
||||
assert_raise FunctionClauseError, fn ->
|
||||
TwoFer.two_fer(:bob)
|
||||
end
|
||||
end
|
||||
|
||||
# @tag :pending
|
||||
test "when the argument is a charlist" do
|
||||
assert_raise FunctionClauseError, fn ->
|
||||
refute TwoFer.two_fer(~c"Jon Snow")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user