Re: [Cppunit-devel] Exception handler
Brought to you by:
blep
From: Noel Y. <Noe...@mo...> - 2003-02-27 18:48:16
|
I see. I had to turn my thinking inside-out. This works great. Thanks a bunch, Noel Baptiste Lepilleur wrote: > > You can get the TestResult by the TestRunner using the method > eventManager(). See the doxygen documentation for that class. > > Baptiste. > > ----- Original Message ----- > From: "Noel Yap" <Noe...@mo...> > To: "Baptiste Lepilleur" <gai...@fr...> > Cc: <cpp...@li...> > Sent: Thursday, February 27, 2003 2:28 PM > Subject: Re: [Cppunit-devel] Exception handler > > > I'm using TestResult::pushProtector(), but how can I use the testResult > > object with CppUnit::TextUi::TestRunner? > > > > Here's a snippet of my code: > > CppUnit::TextUi::TestRunner testRunner; > > > > . > > . > > . > > > > testResult.pushProtector( &messageExceptionProtector ); > > > > testRunner.addTest( testSuite.release() ); > > if( testRunner.run( testResult ) ) // can't do this, no such method > > { > > result = EXIT_SUCCESS; > > } > > > > Thanks, > > Noel > > > > Baptiste Lepilleur wrote: > > > > > > You need to get the TestResult and use the following methods: > > > > > > /// Adds the specified protector to the protector chain. > > > virtual void pushProtector( Protector *protector ); > > > > > > /// Removes the last protector from the protector chain. > > > virtual void popProtector(); > > > > > > Baptiste. > > > > > > ----- Original Message ----- > > > From: "Noel Yap" <Noe...@mo...> > > > To: "Baptiste Lepilleur" <gai...@fr...> > > > Cc: <cpp...@li...> > > > Sent: Wednesday, February 26, 2003 10:36 PM > > > Subject: Re: [Cppunit-devel] Exception handler > > > > > > > Baptiste Lepilleur wrote: > > > > > > > > > > Give a look to class Protector (available since 1.9.10). It allow > > > > > interception of non STL exception. Check the implementation of the > > > > > DefaultProtector for an example of usage. > > > > > > > > This looks good except that I'm using a TextTestRunner and it hides > > > > TestRunner::run( Protector* ). > > > > > > > > Would it hurt anything if a using declaration were used? > > > > > > > > Thanks, > > > > Noel > > > > -- > > > > NOTICE: If received in error, please destroy and notify sender. > Sender > > > > does not waive confidentiality or privilege, and use is prohibited. > > > > > > > > -- > > NOTICE: If received in error, please destroy and notify sender. Sender > > does not waive confidentiality or privilege, and use is prohibited. > > -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. |