News for hackers. Stuff that matters.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests? by Izkata on Friday November 25, 2022 @01:55PM (#33745601)
> Your comment sounds like TDD religion to me.

GP is using the original definition of unit test, GGP is using the religious implementation-level definition TDD advocates have come up with.

From GGP:

> but integration and behaviour tests for the external interface/API are more important than exercising an internal implementation detail.

They call this an integration test, but by the original definition, testing the interface is a unit test. An integration test is how multiple units interact with each other. Testing the implementation details is what TDD advocates have turned unit testing into, by changing the definition of "unit" from semantics (a self-contained module that does one thing from the business perspective) to syntax (a function).

> edit PS: https://tenor.com/view/unittest-unit-test-gif-10813141

Seems like you agree with the original definition. The TDD version of this GIF would be a test for each part that makes up the handle (the implementation details instead of the interface).

Re:Ask HN: Why the Linux Kernel doesn't have unit tests? by hnfong on Friday November 25, 2022 @02:26PM (#33745905)
The semantics doesn't really matter either way. The comment I originally replied to basically implied the whole Linux kernel is one "unit" (or at least each kernel syscall is one unit... which isn't much difference due to large interdependencies between them).

Using that definition, that's just basically saying "the kernel can benefit from ... tests". Of course the Linux kernel doesn't have "TDD-religion unit tests", but there's already more than enough "tests" for the Linux kernel, and there's more than enough benchmark tests for the Linux kernel (for the optimization argument). They're just not "unit" tests in any meaningful way.

From the pedantic side of things, the original comment said "(TDD-religion) unit tests are overrated", then the reply was either "no they're not", or "no, unit tests (as originally defined) are not overrated". The latter is somewhat inconsistent with the "hard disagree", so either they were confused as to which definition they wanted, or cherry picked properties from both unit testing regimes.