-
Notifications
You must be signed in to change notification settings - Fork 7
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
Refactor BFS tests to use gomega #236
Refactor BFS tests to use gomega #236
Conversation
@matejvasek As you are the original author of these tests, some feedback would be great if I understood them right. Note that it is not finished yet, e.g. I have to better understand them to name things. |
@c0d1ngm0nk3y errOurs := fsutil.Walk(root, createWalkFn(&ourFiles))
Expect(errOurs).NotTo(HaveOccurred())
errTheirs := filepath.Walk(root, createWalkFn(&theirFiles))
Expect(errTheirs).NotTo(HaveOccurred()) How is it equivalent to: if (ourFiles == nil) != (theirsFiles == nil) {
t.Errorf("errors does not match, actual error: %#v, expected error: %#v", errOurs, errTheirs)
} Maybe slightly better condition would be The point is to verify that our and stdlib |
It is not at all. That is right. The point is that I didn't understand that part at all. It is exactly one test case, right? So either there are errors in both cases or not. It was used in 2 test cases and both do not return an error, so this was kind of pointless, imho. Or did I miss something?
When simplifying the code like this, I had also the feeling that this is missing. I will try to add. |
Originally that code should have been common for multiple parametrized tests, some of them were supposed to return error. In particular "non-existent root folder" test should have used error propagating walk function but mistakenly I used error masking walk function. |
c608e8c
to
39153a8
Compare
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.
Hello!
I suggest you use consts, when possible, extract the function from the before
and explain the createTestDir
function
Let me know if that makes sense!
a9f107c
to
defefe8
Compare
@anthonydahanne I think I have addressed your comments. Can we get this merged? Just let me know if I oversaw something. |
Co-authored-by: Anthony Dahanne <anthony.dahanne@gmail.com> Signed-off-by: Ralf Pannemans <ralf.pannemans@sap.com>
defefe8
to
1883f27
Compare
Looks good to me. ASCII diagram for the win! @c0d1ngm0nk3y can you update this one more time? Thanks |
I rebased on my local fork; everything went fine, so I went ahead and did it here |
Fixes #234
Summary
Checklist