diff --git a/test/lib/testing.c b/test/lib/testing.c index 11a4c997..f787f875 100644 --- a/test/lib/testing.c +++ b/test/lib/testing.c @@ -246,15 +246,13 @@ void testingTDefer(testingT *t, void (*f)(testingT *t, void *data), void *data) } void testingTRun(testingT *t, const char *subname, void (*subfunc)(testingT *t, void *data), void *data) -{} -#if 0 { testingT *subt; testingprivOutbuf *rewrittenName; char *fullName; rewrittenName = testingprivNewOutbuf(); - while (*subname != "") { + while (*subname != '\0') { const char *replaced; replaced = NULL; @@ -282,7 +280,7 @@ void testingTRun(testingT *t, const char *subname, void (*subfunc)(testingT *t, testingprivOutbufPrintf(rewrittenName, "\\x%x", (unsigned int) (*subname)); subname++; } - fullName = testingSmprintf("%s/%s", t->name, testingprivOutbufString(rewrittenName)); + fullName = testingprivSmprintf("%s/%s", t->name, testingprivOutbufString(rewrittenName)); testingprivOutbufFree(rewrittenName); subt = testingprivNew(testingT); @@ -290,8 +288,7 @@ void testingTRun(testingT *t, const char *subname, void (*subfunc)(testingT *t, subt->opts = t->opts; if (testingprivTRun(subt, t->outbuf) != 0) t->failed = 1; - uiprivFree(subt); + testingprivFree(subt); - uiprivFree(fullName); + testingprivFree(fullName); } -#endif diff --git a/test/lib/testingpriv.c b/test/lib/testingpriv.c index ef48340b..481397ce 100644 --- a/test/lib/testingpriv.c +++ b/test/lib/testingpriv.c @@ -267,3 +267,10 @@ void testingprivOutbufAppendOutbuf(testingprivOutbuf *o, testingprivOutbuf *src) if (hasTrailingBlankLine) buf[trailingBlankLinePos] = '\n'; } + +const char *testingprivOutbufString(testingprivOutbuf *o) +{ + if (o->buf.buf == NULL) + return ""; + return o->buf.buf; +} diff --git a/test/lib/testingpriv.h b/test/lib/testingpriv.h index 6a9170e4..82f13501 100644 --- a/test/lib/testingpriv.h +++ b/test/lib/testingpriv.h @@ -48,3 +48,4 @@ extern void testingprivOutbufFree(testingprivOutbuf *o); extern void testingprivOutbufVprintf(testingprivOutbuf *o, const char *fmt, va_list ap); extern void testingprivOutbufPrintf(testingprivOutbuf *o, const char *fmt, ...); extern void testingprivOutbufAppendOutbuf(testingprivOutbuf *o, testingprivOutbuf *src); +extern const char *testingprivOutbufString(testingprivOutbuf *o);