Disabled the event error tests and started rewriting the no uiInit()/wrong thread checks to use the new programmer error test hooks. I'll also start taking care of the sharedbits cruft now by just providing Strdup and FreeStrdup as utility functions, because bleh.
This commit is contained in:
parent
65226ac416
commit
24320ce784
|
@ -916,6 +916,9 @@ testingTest(EventInvalidateSender)
|
|||
runArgsSubtests(t, &p);
|
||||
}
|
||||
|
||||
#if 0
|
||||
TODOTODO
|
||||
|
||||
static void testWhileFiring(void *sender, void *args, void *data)
|
||||
{
|
||||
testingT *t = (testingT *) data;
|
||||
|
@ -1051,3 +1054,5 @@ testingTest(EventErrors)
|
|||
"attempt to free a uiEvent that still has handlers registered");
|
||||
uiEventFire(firingEvent, NULL, firingEvent);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,8 +6,6 @@ struct errorCase {
|
|||
const char *file;
|
||||
long line;
|
||||
bool caught;
|
||||
char *prefixGot;
|
||||
bool internalGot;
|
||||
char *msgGot;
|
||||
const char *msgWant;
|
||||
struct errorCase *next;
|
||||
|
@ -52,31 +50,20 @@ static void privInternalError(const char *fmt, ...)
|
|||
#undef sharedbitsStatic
|
||||
#undef sharedbitsPrefix
|
||||
|
||||
static void catalogProgrammerError(const char *prefix, const char *msg, const char *suffix, bool internal)
|
||||
static void catalogProgrammerError(const char *msg, void *data)
|
||||
{
|
||||
static struct errorCase *c;
|
||||
size_t n;
|
||||
|
||||
current->caught = true;
|
||||
if (strcmp(prefix, "libui programmer error") != 0) {
|
||||
n = strlen(prefix);
|
||||
current->prefixGot = (char *) malloc((n + 1) * sizeof (char));
|
||||
if (current->prefixGot == NULL) {
|
||||
caseError = caseErrorMemoryExhausted;
|
||||
return;
|
||||
}
|
||||
privStrncpy(current->prefixGot, prefix, n + 1);
|
||||
if (caseError != NULL)
|
||||
return;
|
||||
}
|
||||
current->internalGot = internal;
|
||||
if (strcmp(msg, current->msgWant) != 0) {
|
||||
c->caught = true;
|
||||
if (strcmp(msg, c->msgWant) != 0) {
|
||||
n = strlen(msg);
|
||||
current->msgGot = (char *) malloc((n + 1) * sizeof (char));
|
||||
if (current->msgGot == NULL) {
|
||||
c->msgGot = (char *) malloc((n + 1) * sizeof (char));
|
||||
if (c->msgGot == NULL) {
|
||||
caseError = caseErrorMemoryExhausted;
|
||||
return;
|
||||
}
|
||||
privStrncpy(current->msgGot, msg, n + 1);
|
||||
privStrncpy(c->msgGot, msg, n + 1);
|
||||
if (caseError != NULL)
|
||||
return;
|
||||
}
|
||||
|
@ -101,8 +88,6 @@ static void freeCases(struct errorCase *first)
|
|||
|
||||
p = first;
|
||||
while (p != NULL) {
|
||||
if (p->prefixGot != NULL)
|
||||
free(p->prefixGot);
|
||||
if (p->msgGot != NULL)
|
||||
free(p->msgGot);
|
||||
next = p->next;
|
||||
|
@ -120,11 +105,6 @@ static void reportCases(testingT *t, struct errorCase *p)
|
|||
p = p->next;
|
||||
continue;
|
||||
}
|
||||
if (p->prefixGot != NULL)
|
||||
// TODO use diff
|
||||
testingTErrorfFull(t, p->file, p->line, "%s prefix string doesn't contain \"programmer error\": %s", p->name, p->prefixGot);
|
||||
if (p->internalGot)
|
||||
testingTErrorfFull(t, p->file, p->line, "%s error is marked internal; should not have been", p->name);
|
||||
if (p->msgGot != NULL)
|
||||
// TODO use diff
|
||||
testingTErrorfFull(t, p->file, p->line, "%s message doesn't contain expected substring:" diff("%s"),
|
||||
|
|
Loading…
Reference in New Issue