Re: Most user-friendly version of CppUnit

Noel Yap <Noel.Yap-/PgpppG8B+R7qynMiXIxWgC/[email protected]> Tue, 12 Aug 2003 11:39:49 -0400
Newsgroups gmane.comp.lib.cppunit.devel
Organization Morgan Stanley
Message-ID <[email protected]>
Baptiste Lepilleur wrote:
> Surely someone fixed this parsing issue. At worth, CPPUNIT macros should be
> consider as function declaration with omitted return type. But this kind of
> macros is already specific to CppUnit. A few libraries with similar macros
> that come to mind: Qt, WxWindow, MFC. Fairly common stuffs.

Even if someone did fix the emacs parsing, I consider it a hack that'll work so long as CppUnit doesn't change or add macro names.

> I don't know of any better way to 'generate' code than those 'fairly' simple
> macro. May be you would like to share (cppunit v2 is relying on a similar
> scheme at the time).

I can't send the entire script, but here's a snippet (which may not make sense outside the context of the rest of it):

        for test_header in $$test_headers; \
        do \
                test_fqbn=`echo $$test_header | sed -e 's/.*\/lib\/\\(.*\\)\\.H/
\\1/g' -e 's/\//::/g'`; \
                grep 'void  *test[a-zA-Z0-9_][a-zA-Z0-9_]* *( *)' $$test_header 
\
                        | sed -e 's/.* \(test[^ (]*\).*/\1/' \
                        | while read t; \
                        do \
                                echo "  testSuite->addTest("; \
                                echo "    new CppUnit::TestCaller< $$test_fqcn >
("; \
                                echo "      \"$$test_fqbn::$$t\","; \
                                echo "      &$$test_fqcn::$$t) );"; \
                        done; \
        done; \

It may look strange since it's a script within a makefile.

HTH,
Noel
-- 
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive confidentiality or privilege, and use is prohibited.


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01