Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.

Commit

Permalink
support 2+ params
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Jul 6, 2018
1 parent 1435ae2 commit 856f970
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ex_parameterized/params.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule ExUnit.Parameterized.Params do
{:{}, _, [{:%{}, _, _}]} ->
true

[{:{}, _, [{:%{}, _, _}]}] ->
head_list when is_list(head_list) ->
validate_map?(head)

_ ->
Expand Down
2 changes: 1 addition & 1 deletion lib/ex_parameterized/params_callback.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule ExUnit.Parameterized.ParamsCallback do
{:{}, _, [{:%{}, _, _}]} ->
true

[{:{}, _, [{:%{}, _, _}]}] ->
head_list when is_list(head_list) ->
validate_map?(head)

_ ->
Expand Down
6 changes: 6 additions & 0 deletions test/ex_parameterized_callback_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ defmodule ExParameterizedParamsCallbackTest do
Enum.map([{%{b: 1, c: 2}}], fn x -> x end)
end

test_with_params "ast from enum of maps 2", context, fn a ->
assert a == %{b: 1, c: 2}
end do
Enum.map([{%{b: 1, c: 2}}, {%{b: 1, c: 2}}], fn x -> x end)
end

test_with_params "add description for each params with context", context, fn a, b, expected ->
str = a <> " and " <> b
assert str == expected
Expand Down
6 changes: 6 additions & 0 deletions test/ex_parameterized_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ defmodule ExParameterizedTest do
Enum.map([{%{b: 1, c: 2}}], fn x -> x end)
end

test_with_params "ast from enum of maps 2", fn a ->
assert a == %{b: 1, c: 2}
end do
Enum.map([{%{b: 1, c: 2}}, {%{b: 1, c: 2}}], fn x -> x end)
end

test_with_params "with function", fn p ->
p
end do
Expand Down

0 comments on commit 856f970

Please sign in to comment.