Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

11
  • 1
    ah.. this is probably the best solution, unfortunately my project doesn't do unit testing :( one more case to add to the list to try to convince them! Commented Feb 5, 2020 at 19:01
  • 24
    @AdamB: even if you will do unit testing, creating a test which will fail if a renderer produces artifacts will become challenging. Sorry, but just because you have a hammer (unit tests), not every problem is a nail. For this specific case, I am pretty sure the best solution is a comment. Commented Feb 5, 2020 at 20:17
  • 4
    @AdamB: then you would have to comment on the test why it is necessary, since the test itself would not be self-explaining in the same way the one-line above isn't. Sorry, but that is a non-solution. Commented Feb 5, 2020 at 22:26
  • 1
    @DocBrown Any decent unit test framework will have a way of describing the test (or its failures) and what it hopes to accomplish. The benefit over a simple comment is that it's systematic and will actually break when the code is changed: it doesn't rely on the programmer paying attention and the comment being up to date. Adding a comment is absolutely fine, but calling a unit test a non-solution seems absurd to me. Commented Feb 6, 2020 at 8:30
  • 6
    So the workflow is: 1.) look at code, find strange/unnecessary statement; 2.) remove the statement; 3.) fire up unit-test (perhaps some hours later); 4.) read documentation for failing test that I never saw before 5.) put the strange statement back in. Commented Feb 6, 2020 at 13:57