[Development] Supporting helper functions in auto tests by providing throwing Qt Test macros
Mitch Curtis
mitch.curtis at qt.io
Wed Apr 3 14:04:25 CEST 2019
> -----Original Message-----
> From: Development <development-bounces at qt-project.org> On Behalf Of
> Robin Burchell
> Sent: Wednesday, 3 April 2019 12:53 PM
> To: development at qt-project.org
> Subject: Re: [Development] Supporting helper functions in auto tests by
> providing throwing Qt Test macros
>
> On Tue, Apr 2, 2019, at 5:17 PM, Mitch Curtis wrote:
> > Quoting the commit message here:
> >
> > WIP: Add _THROW variants to testlib macros
> >
> > This allows using Qt Test macros in helper functions, avoiding the need
> > to write a lot of boilerplate code as seen with alternative approaches.
>
> Allowing other functions to terminate a test would be great, but I wonder if
> it's worth considering changing the "regular" macros to terminate tests
> through an exception it throws internally, thus avoiding the need to
> introduce a new set of macros.
>
> You could of course introduce a new macro specifically to throw (and I think
> that would be a good idea to automatically gather __FILE__ and __LINE__ in
> a non-messy way), but this way one could just use the regular macros we
> already know and love in new ways.
>
> It would mean that tests would need to support exceptions unconditionally,
> but since it's "just" test code, perhaps this isn't that big a problem.
Just replying to say that Robin and I discussed this on IRC and I think it would be better than introducing new macros, so long as it's actually acceptable to do so.
> --
> Robin Burchell
> robin at crimson.no
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
More information about the Development
mailing list