[Libreoffice-bugs] [Bug 122169] New: Simpler cppunit tests, use CPPUNIT_TEST_FIXTURE

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Tue Dec 18 10:58:56 UTC 2018


https://bugs.documentfoundation.org/show_bug.cgi?id=122169

            Bug ID: 122169
           Summary: Simpler cppunit tests, use CPPUNIT_TEST_FIXTURE
           Product: LibreOffice
           Version: Inherited From OOo
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Keywords: difficultyInteresting, easyHack, skillCpp,
                    topicCleanup
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: vmiklos at collabora.com

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

It would be good to use this markup in our cppunit tests, if you just grep for
CPPUNIT_TEST_SUITE, you'll see the places that could be converted over to
CPPUNIT_TEST_FIXTURE.

One test suite conversion / commit, please.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20181218/0fae9edc/attachment.html>


More information about the Libreoffice-bugs mailing list