Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Normally I would agree for webapps but in this case, it's for generating low-level code.

In general, It's only a mistake if it's burdensome. I only have about 30 of these tests, and they are for critical code (I want the end user to be able to review the test and be confident that the generated code doesn't contain memory leaks, etc).

https://github.com/ityonemo/zigler/blob/3de4d6fe4def265b689b...



But can't you identify the signal of the input and output and write small test cases to test just the signal?

Snaps test the signal + noise. They help alert you when either changed, which is helpful if you think you may be missing tests for the signal, but ideally you would just make sure all the signal is tested, and the snaps would be just a later, independent sanity check tool.

Obviously you know the details and often once I learn the details I'm like "oh yeah in this case I see how the cost benefit makes sense". Just more speaking in generalities.


> They help alert you when either changed

that's exactly what I'm looking for =D. See response to sibling comment for why I also want to be able to review the full code layout.


Taking a quick peak at the code, maybe more smaller functions with fewer params to make it more testable?

Sorry that could be way off, just have limited time right now.


I also do that, but since it's a LL programming language, there is coupling (a resource created in one place may be destroyed by different function).




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: