Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
Fully Compatible
-
ALL
-
Dev Tools 2019-09-23, Dev Tools 2019-10-07
Description
Two problems:
1)
Dangling else. These macros are the body of an if statement.
if (expression) FAIL(...)
That means they will bind to an immediately subsequent else, a bug.
This code should assert b if cond is true.
If cond is not true, eExpr should run.
if (cond)
|
ASSERT_TRUE(b);
|
else {
|
eExpr
|
}
|
|
|
will expand with the else binding to the interior if:
|
|
|
if (cond){
|
if(b) {
|
FAIL(...)
|
} else {
|
eExpr
|
}
|
}
|
|
Which doesn't run eExpr unless cond is true.
2)
Should expose a stream() object to append detail. Some do. Many do not.
ASSERT_FOO(x, y, z) << "details go here: uid=" << uid << ", x=" << x;
The macros must be rewritten to follow a standard format.