Simpler cppunit tests, CPPUNIT_TEST_FIXTURE
vmiklos at collabora.co.uk
Thu Nov 8 08:13:45 UTC 2018
adds a macro in cppunit that allows not spelling out the declaration /
definition / registration of a testcase in a testsuite, but you can just
do all of this with a single line of code. If you used googletest in
other projects, this is probably familiar to you.
This is just a macro, so it's easy to "bundle" it in core.git (for both
the system and bundled cppunit case), so we can unconditionally use it
right now. An example conversion looks like this:
Hopefully it's obvious how this avoids repetition, also makes it
impossible to get the wrapping ifdefs wrong around the
declaration/definition/registration in case such a condition is
Declaring what exact testcase you want to run is still possible by
setting CPPUNIT_TEST_NAME to "testFoo" from
Do anybody see this as a controversial move? If not, I think it would be
good to use this markup in two cases:
- new tests where you don't need to convert anything
- old tests where custom macros are used to do something similar, e.g.
DECLARE_OOXMLEXPORT_TEST() (those custom macros are hard to understand
if you don't work on that area, cf. Stephan's conference talk
Perhaps an easy hack could be created for the second point, but I would
prefer some feedback before I go further with this.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 195 bytes
Desc: Digital signature
More information about the LibreOffice