Re: Exception handler

Noel Yap <Noel.Yap-/PgpppG8B+R7qynMiXIxWgC/[email protected]> Thu, 27 Feb 2003 08:28:42 -0500
Newsgroups gmane.comp.lib.cppunit.devel
Organization Morgan Stanley
Message-ID <[email protected]>
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" <Noel.Yap-/PgpppG8B+R7qynMiXIxWgC/[email protected]>
> To: "Baptiste Lepilleur" <[email protected]>
> Cc: <[email protected]>
> 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.


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com