-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix destructure structs implementation #4
Fix destructure structs implementation #4
Conversation
@danielberkompas please have a look |
|
||
describe "structs" do | ||
test "can't match with different structs" do | ||
refute d(%People{}) == %Person{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be refute d(%People{}) = %Person{}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, if we use assignment match, it will raise MatchError
before refute
evaluation takes action. Try using assert d(%People{}) == %Person{}
, we will get the expected failure
1) test structs can't match with different structs (DestructureTest)
test/destructure_test.exs:17
Assertion with == failed
code: d(%People{}) == %Person{}
lhs: %DestructureTest.People{people: nil}
rhs: %DestructureTest.Person{email: nil, name: nil}
stacktrace:
test/destructure_test.exs:18: (test)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or should I change it to use assert_raise
? I guess it's more make sense to do it
@danielberkompas please have a look with the update |
Looks good to me, @muhifauzan! |
Resolves #2