In the tests, we have the option to either do
assert 1 + 1 == 2
assert one_plus_one() == 2
or
assert 2 == 1 + 1
assert 2 == one_plus_one()
While the first approach may be more intuitive, it is not possible to follow that order when using pattern matching. This is the only option:
assert %{result: 2} = %{result: 1 + 1, other_key: 3}
assert %{result: 2} = one_plus_one_in_a_map()
So in this case the expected value must always be on the left-hand side.
So I propose that we follow the pattern of always having the expected on the left-hand side and the value being tested on the right, allowing us to keep the pattern between == and pattern matches.
In the tests, we have the option to either do
or
While the first approach may be more intuitive, it is not possible to follow that order when using pattern matching. This is the only option:
So in this case the expected value must always be on the left-hand side.
So I propose that we follow the pattern of always having the expected on the left-hand side and the value being tested on the right, allowing us to keep the pattern between
==and pattern matches.