approvals / ApprovalTests.cpp

Native ApprovalTests for C++ on Linux, Mac and Windows
https://approvaltestscpp.readthedocs.io/en/latest/
Apache License 2.0
318 stars 51 forks source link

Allow documentation samples to be copied without editing #115

Closed claremacrae closed 3 years ago

claremacrae commented 4 years ago

Having spent several hours yesterday pairing with a new user, we copied a lot of examples from our docs, and in every case, we had to paste in our namespace ApprovalTests:: - it got very old, very quickly - and I ended up agreeing with this:

https://twitter.com/lefticus/status/1207890691948339200

Please, I implore you, in the name of all that is good, do NOT use using namespace in your examples for your library.

It makes it impossible to figure out where things come from when we are studying the examples.

At least for example and test code that is included in snippets, I would now really like to ban using namespace ApprovalTests; in any of our source files where there is a snippet defined! And also, add a check to fail the build if such a usage slips back in, in future...

claremacrae commented 3 years ago

This is now done. All example snippets of code either explicitly state the ApprovalTests:: or say using namespace...