Move koan about keyword lists as arguments to the function koan
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user