Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define rule for asserts #8

Open
gabrielpra1 opened this issue Dec 7, 2020 · 0 comments
Open

Define rule for asserts #8

gabrielpra1 opened this issue Dec 7, 2020 · 0 comments

Comments

@gabrielpra1
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant