Made the test for an invalid control type slightly more robust by not using either 0 or 5 for the fake object (but rather some other value that isn't the constant and that's also conveniently ASCII) and deduplicating the redundant tests.
This commit is contained in:
parent
c52656f2c2
commit
e71c717b31
|
@ -222,7 +222,8 @@ void *uiControlImplData(uiControl *c)
|
|||
}
|
||||
|
||||
static uiControl testHookControlWithInvalidControlMarker = {
|
||||
.controlID = 0,
|
||||
// use something other than 0 here to make it look like accidental real data
|
||||
.controlID = UINT32_C(0x5A5A5A5A),
|
||||
};
|
||||
|
||||
uiControl *uiprivTestHookControlWithInvalidControlMarker(void)
|
||||
|
|
|
@ -176,19 +176,7 @@ Test(CheckingNullControlIsProgrammerError)
|
|||
endCheckProgrammerError(ctx);
|
||||
}
|
||||
|
||||
// TODO should this test be the same as the following one instead?
|
||||
Test(CheckingNonControlIsProgrammerError)
|
||||
{
|
||||
// TODO make sure this is fine; if not, just use the following check instead
|
||||
static char buf[] = "this is not a uiControl but is big enough to at the very least not cause a problem with UB hopefully";
|
||||
void *ctx;
|
||||
|
||||
ctx = beginCheckProgrammerError("uiCheckControlType(): object passed in not a uiControl");
|
||||
uiCheckControlType(buf, uiControlType());
|
||||
endCheckProgrammerError(ctx);
|
||||
}
|
||||
|
||||
Test(CheckingControlWithoutControlMarkerIsProgrammerError)
|
||||
{
|
||||
void *ctx;
|
||||
|
||||
|
|
Loading…
Reference in New Issue