Simpler cppunit tests, CPPUNIT_TEST_FIXTURE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

<https://cgit.freedesktop.org/libreoffice/cppunit/commit/?id=48145587c4c2dc4f1e07d83073e136336c81ce79>
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:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=caec23449a21c0eacbb593330a5b22f8c60d58e8

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
necessary.

Declaring what exact testcase you want to run is still possible by
setting CPPUNIT_TEST_NAME to "testFoo" from
CPPUNIT_TEST_FIXTURE(FooTest, testFoo).

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
  recently).

Perhaps an easy hack could be created for the second point, but I would
prefer some feedback before I go further with this.

Thanks,

Miklos

Attachment: signature.asc
Description: Digital signature

_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux