Re: Most user-friendly version of CppUnit
"Baptiste Lepilleur" <[email protected]> Mon, 8 Sep 2003 21:25:40 +0200
| Newsgroups | gmane.comp.lib.cppunit.devel |
|---|---|
| Message-ID | <009301c3763e$fe476e90$3c80c2d4@gaia> |
----- Original Message ----- From: "Noel Yap" <Noel.Yap-/PgpppG8B+R7qynMiXIxWgC/[email protected]> To: "Baptiste Lepilleur" <[email protected]> Cc: <[email protected]> Sent: Tuesday, August 12, 2003 5:39 PM Subject: Re: [Cppunit-devel] Most user-friendly version of CppUnit > 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. You should not need to rely on the macro name to parse this. A structure of the forms "id( expression-list);" could be parsed as a function declaration returning int (well, that's how I would do it). As I said this kind of macro is not specific to cppunit. I certainly won't remove those because a text editor can not ident correctly ;-) > > 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). Which is not portable. It relies on a specific build system, as well as a shell environment. Beginners would probably run away ;-). Also, this slow down the build process. I like being able to run my test plug-in a a few seconds ;-) You might want to look up project cuppa (http://sourceforge.jp/projects/cuppa/) which (I believe) provides a portable implementation to do that. > 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 is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf