Started mapping filenames and line numbers back to their appropriate places in the tester.

This commit is contained in:
Pietro Gagliardi 2019-06-02 01:13:56 -04:00
parent 4ae6ab2727
commit 1cf545d369
2 changed files with 11 additions and 9 deletions

View File

@ -72,8 +72,7 @@ static void wantBlocked(struct handler *h)
h->wantBlocked = true;
}
// TODO carry over the file and line numbers somehow
static void run(testingT *t, uiEvent *e, void *sender, void *args, struct handler *handlers, int n, int wantRunCount)
static void runFull(testingT *t, const char *file, long line, uiEvent *e, void *sender, void *args, struct handler *handlers, int n, int wantRunCount)
{
int i;
int gotRunCount;
@ -89,9 +88,9 @@ static void run(testingT *t, uiEvent *e, void *sender, void *args, struct handle
h = handlers;
for (i = 0; i < n; i++) {
if (!h->gotRun && h->wantRun)
testingTErrorf(t, "%s not run; should have been", h->name);
testingTErrorfFull(t, file, line, "%s not run; should have been", h->name);
else if (h->gotRun && !h->wantRun)
testingTErrorf(t, "%s run; should not have been", h->name);
testingTErrorfFull(t, file, line, "%s run; should not have been", h->name);
if (h->gotRun && h->wantRun) {
// only check these if it was correctly run, to reduce noise if the above failed
if (h->gotSender != h->wantSender)
@ -105,9 +104,9 @@ static void run(testingT *t, uiEvent *e, void *sender, void *args, struct handle
// the following call will fail if the ID isn't valid
gotBlocked = uiEventHandlerBlocked(e, h->id);
if (!gotBlocked && h->wantBlocked)
testingTErrorf(t, "%s not blocked; should have been", h->name);
testingTErrorfFull(t, file, line, "%s not blocked; should have been", h->name);
else if (gotBlocked && !h->wantBlocked)
testingTErrorf(t, "%s blocked; should not have been", h->name);
testingTErrorfFull(t, file, line, "%s blocked; should not have been", h->name);
}
h++;
}
@ -116,6 +115,8 @@ static void run(testingT *t, uiEvent *e, void *sender, void *args, struct handle
"%d", gotRunCount, wantRunCount);
}
#define run(t, e, sender, args, handlers, n, wantRunCount) runFull(t, __FILE__, __LINE__, e, sender, args, handlers, n, wantRunCount)
struct baseParams {
void (*impl)(testingT *t, void *data);
bool global;

View File

@ -109,8 +109,7 @@ static void queueOrder(struct testParams *p)
uiQueueMain(done, NULL);
}
// TODO somehow funnel the caller's file/line through
static void checkOrder(testingT *t, uint32_t flag)
static void checkOrderFull(testingT *t, const char *file, long line, uint32_t flag)
{
int i;
@ -128,6 +127,8 @@ static void checkOrder(testingT *t, uint32_t flag)
orders[0].result, orders[0].order);
}
#define checkOrder(t, flag) checkOrderFull(t, __FILE__, __LINE__, flag)
testingTest(QueueMain_Sequence)
{
struct testParams p;