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);
|
runArgsSubtests(t, &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
TODOTODO
|
||||||
|
|
||||||
static void testWhileFiring(void *sender, void *args, void *data)
|
static void testWhileFiring(void *sender, void *args, void *data)
|
||||||
{
|
{
|
||||||
testingT *t = (testingT *) data;
|
testingT *t = (testingT *) data;
|
||||||
|
@ -1051,3 +1054,5 @@ testingTest(EventErrors)
|
||||||
"attempt to free a uiEvent that still has handlers registered");
|
"attempt to free a uiEvent that still has handlers registered");
|
||||||
uiEventFire(firingEvent, NULL, firingEvent);
|
uiEventFire(firingEvent, NULL, firingEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -6,8 +6,6 @@ struct errorCase {
|
||||||
const char *file;
|
const char *file;
|
||||||
long line;
|
long line;
|
||||||
bool caught;
|
bool caught;
|
||||||
char *prefixGot;
|
|
||||||
bool internalGot;
|
|
||||||
char *msgGot;
|
char *msgGot;
|
||||||
const char *msgWant;
|
const char *msgWant;
|
||||||
struct errorCase *next;
|
struct errorCase *next;
|
||||||
|
@ -52,31 +50,20 @@ static void privInternalError(const char *fmt, ...)
|
||||||
#undef sharedbitsStatic
|
#undef sharedbitsStatic
|
||||||
#undef sharedbitsPrefix
|
#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;
|
size_t n;
|
||||||
|
|
||||||
current->caught = true;
|
c->caught = true;
|
||||||
if (strcmp(prefix, "libui programmer error") != 0) {
|
if (strcmp(msg, c->msgWant) != 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) {
|
|
||||||
n = strlen(msg);
|
n = strlen(msg);
|
||||||
current->msgGot = (char *) malloc((n + 1) * sizeof (char));
|
c->msgGot = (char *) malloc((n + 1) * sizeof (char));
|
||||||
if (current->msgGot == NULL) {
|
if (c->msgGot == NULL) {
|
||||||
caseError = caseErrorMemoryExhausted;
|
caseError = caseErrorMemoryExhausted;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
privStrncpy(current->msgGot, msg, n + 1);
|
privStrncpy(c->msgGot, msg, n + 1);
|
||||||
if (caseError != NULL)
|
if (caseError != NULL)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -101,8 +88,6 @@ static void freeCases(struct errorCase *first)
|
||||||
|
|
||||||
p = first;
|
p = first;
|
||||||
while (p != NULL) {
|
while (p != NULL) {
|
||||||
if (p->prefixGot != NULL)
|
|
||||||
free(p->prefixGot);
|
|
||||||
if (p->msgGot != NULL)
|
if (p->msgGot != NULL)
|
||||||
free(p->msgGot);
|
free(p->msgGot);
|
||||||
next = p->next;
|
next = p->next;
|
||||||
|
@ -120,11 +105,6 @@ static void reportCases(testingT *t, struct errorCase *p)
|
||||||
p = p->next;
|
p = p->next;
|
||||||
continue;
|
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)
|
if (p->msgGot != NULL)
|
||||||
// TODO use diff
|
// TODO use diff
|
||||||
testingTErrorfFull(t, p->file, p->line, "%s message doesn't contain expected substring:" diff("%s"),
|
testingTErrorfFull(t, p->file, p->line, "%s message doesn't contain expected substring:" diff("%s"),
|
||||||
|
|
Loading…
Reference in New Issue