Hacker News new | past | comments | ask | show | jobs | submit login

The C++ testing framework Catch2 enables this kind of testing. The first time I saw it I couldn't figure out how some of the tests would even pass.

It turns out that using some evil macro magic, each test re-runs from the start for each inner section [1]. It also makes deduplicating setup code completely painless and natural.

You just have to get over the completely non-standard control flow. It's a good standard bearer for why metaprogramming is great, even if you're forced to do it in C/C++'s awful macro system.

[1] https://github.com/catchorg/Catch2/blob/devel/docs/tutorial....




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

Search: