EXPECT_CALL failed, but Test::HasFailure()==false in testcase destructor
- Dominant language
- C++
- Stars
- 39.5k
- Forks
- 10.9k
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
description as title
expect Test::HasFailure()==true (actually ==false)
**Steps to reproduce the bug**
struct MyTest : public Test
{
~MyTest()
{
if (Test::HasFailure()) "do sth"
}
};
TEST_F(MyTest, test1)
{
...
EXPECT_CALL(...); //let it fail
...
}
**Does the bug persist in the most recent commit?**
yes
**What operating system and version are you using?**
> uname -a
Linux ... 5.15.35-1.NSN.el7.x86_64 #1 SMP Tue May 24 15:26:52 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
**What compiler and version are you using?**
gcc version 10.2.0 (GCC)
**What build system are you using?**
cmake version 3.19.5
Contributor guide
Research direction
Start with the MyTest destructor and the Test::HasFailure() path in the provided EXPECT_CALL reproduction, then run the test under the stated Linux, GCC, and CMake setup. Trace when the mock expectation failure is recorded relative to testcase destruction; done means HasFailure() reports true in the destructor for this failing case, with a regression test covering it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100