Vlad is investigating this. I suspect that #1 doesn't have a simple
solution. However, it's very easy to implement HasNonFatalFailure()
and HasFailure(), so we can solve #2 first.
>
--
Zhanyong
Checking whether there are failures in a test using the event listener
API is more involved than calling HasFailure(). You need to implement
the listener interface and register it. I suggest to implement
HasFailure(), which is trivial to do and more convenient for Kevin's
need.
--
Zhanyong
FYI, I have a draft implementation for HasFailure() and
HasNonFatalFailure(). Will probably clean it up and have it reviewed
on Monday.
These functions have been requested before, and we decided to wait
until there's more demand. Now seems a good time to do it finally.
--
Zhanyong
We've considered this. The problem is that each test function can
generate an unbounded number of failures (note that most other
frameworks will allow only one failure in each test function), and
each failure can contain a custom message that's arbitrarily long.
Therefore we may run out of space with a pre-allocated pool approach.
Plus, soon we'll open the event listener interface to allow people to
write plug-ins to respond to various gtest events. Such plug-ins may
allocate memory any time they want, any way they want.
Therefore I think realistically we'll not attempt to catch the leaks
when there is a failure already. Let's make it possible to catch the
leaks when there is otherwise no failure first.
>
> - Kevin
>
--
Zhanyong