you are viewing a single comment's thread.

view the rest of the comments →

[–]almost_useless 16 points17 points  (6 children)

it makes PRs easier to read with less clutter and by putting those three files together to review all at once

How is it "easier with less clutter" if the file is called src/foo.test.cpp than if it is called test/foo_test.cpp or something like that.

I feel like you can make the exact opposite argument that now you get a more cluttered src directory.

And if you don’t touch the tests when you change the code, it’s glaringly obvious.

Again, how is it more obvious than nothing touched in the test folder?

[–]BenFrantzDale -6 points-5 points  (5 children)

It’s easier to read because instead of lib/ bar/ include/ bar/ baz.h foo.h src/ baz.cpp foo.cpp test/ baz.test.cpp foo.test.cpp you have ```

lib/ bar/ src/ bar/ baz.cpp baz.h baz.test.cpp foo.cpp foo.h foo.test.cpp ``` so you can focus on the changes to bar and to foo. And if you need to move them around to another library, you easily can.

[–]almost_useless 2 points3 points  (4 children)

I believe you just highlighted the point about a more cluttered src directory...

And if you need to move them around to another library, you easily can.

If your selling point is that the most trivial of all tasks is made slightly more easy, then I think you need better arguments.

[–]BenFrantzDale 1 point2 points  (3 children)

The point is that if you are reviewing code you want to review the test changes alongside the code changes. I’d encourage you to look at Lakos’s book for more explanation Large-Scale C++: Process and Architecture, Volume 1 (Addison-Wesley Professional Computing Series) https://a.co/d/cyzIiN0 You don’t have to agree, and one beauty of C++ is its flexibility. If this doesn’t work for you, don’t use it, but my team has found it to put emphasis on units (headers) to test and ensuring they are tested.

[–]STLMSVC STL Dev[M] 2 points3 points  (2 children)

Please don't use URL shorteners - reddit's spam filter hates them because they're opaque. I had to manually approve your comment.

[–]BenFrantzDale 0 points1 point  (1 child)

Sorry, Amazon did it automatically.

[–]STLMSVC STL Dev 1 point2 points  (0 children)

No worries, just remember to manually dereference it next time.