Merge pull request #132 from iamvery/keyword-list-update
Keyword List update
This commit is contained in:
@@ -34,9 +34,14 @@ defmodule KeywordLists do
|
|||||||
|
|
||||||
koan "Conveniently keyword lists can be used for function options" do
|
koan "Conveniently keyword lists can be used for function options" do
|
||||||
transform = fn str, opts ->
|
transform = fn str, opts ->
|
||||||
if opts[:upcase], do: String.upcase(str)
|
if opts[:upcase] do
|
||||||
|
String.upcase(str)
|
||||||
|
else
|
||||||
|
str
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
assert transform.("good", upcase: true) == ___
|
assert transform.("good", upcase: true) == ___
|
||||||
|
assert transform.("good", upcase: false) == ___
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ defmodule KeywordListsTests do
|
|||||||
"baz",
|
"baz",
|
||||||
{:multiple, [:foo, "bar"]},
|
{:multiple, [:foo, "bar"]},
|
||||||
"foo",
|
"foo",
|
||||||
"GOOD",
|
{:multiple, ["GOOD", "good"]},
|
||||||
]
|
]
|
||||||
|
|
||||||
test_all(KeywordLists, answers)
|
test_all(KeywordLists, answers)
|
||||||
|
|||||||
Reference in New Issue
Block a user