4 ms·
IME it's an OK way to show examples which are validated (and thus don't get broken as the API changes), but it's really not a good way to have actual tests. Ter
by masklinn 9y ago
IME it's an OK way to show examples which are validated (and thus don't get broken as the API changes), but it's really not a good way to have actual tests. Terrible debugging experience aside, actual unit tests just make very little sense as part of a documentation.
- ch4s3 9y agoThey're really only for documentation and the simplest of single function unit tests.
- pmontra 9y agoThe idea is to provide a DRY way to ensure that the examples are correct. Few things are worse than a wrong example.
- masklinn 9y agoThat's a fine idea and exactly why doctests exist but I am specifically replying to a comment talking about tests. Not testing examples, having actual tests included in the documentation. Which, again, experience taught me is a terrible idea.