Yes, perhaps you only need unquoteboth input, and expected_outputin the block dothat you pass on test/2.
test_cases = %{
"foo" => 1,
"bar" => 2,
"baz" => 3,
}
Enum.each test_cases, fn({input, expected_output}) ->
test "for #{input}" do
assert Mymodule.myfunction(unquote(input)) == unquote(expected_output)
end
end
Btw, you had a parens error in the string assert, since you assert/1only called with Mymodule.myfunction inputas your argument instead Mymodule.myfunction(input) == expected_output(which is the expression you are trying to assert).
source
share