Re: Exception handler

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

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