Move koan about keyword lists as arguments to the function koan

This commit is contained in:
Felipe Sere
2018-02-02 07:55:14 +00:00
parent bbb085a66b
commit 1a62898883
4 changed files with 14 additions and 14 deletions

View File

@@ -31,17 +31,4 @@ defmodule KeywordLists do
assert_raise ArgumentError, fn -> not_kw_list[___] end
end
koan "Conveniently keyword lists can be used for function options" do
transform = fn str, opts ->
if opts[:upcase] do
String.upcase(str)
else
str
end
end
assert transform.("good", upcase: true) == ___
assert transform.("good", upcase: false) == ___
end
end

View File

@@ -97,4 +97,17 @@ defmodule Functions do
assert result == ___
end
koan "Conveniently keyword lists can be used for function options" do
transform = fn str, opts ->
if opts[:upcase] do
String.upcase(str)
else
str
end
end
assert transform.("good", upcase: true) == ___
assert transform.("good", upcase: false) == ___
end
end