> -----Original Message----- > From: Edward Welbourne > Sent: Wednesday, 3 April 2019 12:07 PM > To: Joerg Bornemann <[email protected]>; Mitch Curtis > <[email protected]> > Cc: [email protected] > Subject: Re: [Development] Supporting helper functions in auto tests by > providing throwing Qt Test macros > > On 4/2/19 5:14 PM, Mitch Curtis wrote: > >> As described in https://bugreports.qt.io/browse/QTBUG-66320, > >> currently Qt users are on their own if they want to call helper > >> functions that can fail a test. The reason is documented: > >> > >> Note: This macro can only be used in a test function that is > >> invoked by the test framework. > > This note is not strictly true. You can use it in any function that returns > void. > However, the *caller* won't return in response to it, which means it doesn't > work *fully* in a helper.
It's true enough that we would never recommend users to use it in a helper function, hence the note. Tests should be able to assume that any code that comes after a call to a helper means that the helper succeeded. That assumption fails if you were to use e.g. QVERIFY in that helper and it failed. I actually wrote that in my initial email, but I removed it before sending it because I didn't think anyone would be pedantic enough to warrant it. _______________________________________________ Development mailing list [email protected] https://lists.qt-project.org/listinfo/development
