X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/c5e0e40378b7e209521d2e9a52f055575a948313..3efcfd2df21aa11bd9d1ba5ea2f5f490fd4d5b84:/test/tvec-core.c diff --git a/test/tvec-core.c b/test/tvec-core.c index 6aa49fa..03873dc 100644 --- a/test/tvec-core.c +++ b/test/tvec-core.c @@ -392,7 +392,7 @@ static void begin_test_group(struct tvec_state *tv, struct groupstate *g) } } -void tvec_reportgroup(struct tvec_state *tv) +static void report_group(struct tvec_state *tv) { unsigned i, out, nrun; @@ -404,7 +404,7 @@ void tvec_reportgroup(struct tvec_state *tv) else { if (tv->curr[TVOUT_LOSE]) out = TVOUT_LOSE; else out = TVOUT_WIN; - tv->grps[out]++; tv->output->ops->egroup(tv->output, out); + tv->grps[out]++; tv->output->ops->egroup(tv->output); } } @@ -415,7 +415,7 @@ static void end_test_group(struct tvec_state *tv, struct groupstate *g) if (!t) return; if (tv->f&TVSF_OPEN) check(tv, g); - if (!(tv->f&TVSF_SKIP)) tvec_reportgroup(tv); + if (!(tv->f&TVSF_SKIP)) report_group(tv); env = t->env; if (env && env->teardown) env->teardown(tv, g->ctx); release_registers(tv); tv->test = 0; xfree(g->ctx); g->ctx = 0; } @@ -548,9 +548,7 @@ void tvec_begin(struct tvec_state *tv_out, tv_out->tests = config->tests; tv_out->test = 0; tv_out->infile = 0; tv_out->lno = 0; tv_out->fp = 0; - o->tv = tv_out; tv_out->output = o; - - tv_out->output->ops->bsession(tv_out->output); + tv_out->output = o; tv_out->output->ops->bsession(tv_out->output, tv_out); } int tvec_end(struct tvec_state *tv) @@ -636,7 +634,7 @@ void tvec_begingroup(struct tvec_state *tv, const char *name, void tvec_endgroup(struct tvec_state *tv) { - if (!(tv->f&TVSF_SKIP)) tvec_reportgroup(tv); + if (!(tv->f&TVSF_SKIP)) report_group(tv); tv->test = 0; } @@ -680,19 +678,27 @@ static void adhoc_claim_teardown(struct tvec_state *tv, if (ck->f&ACF_FRESH) tvec_endtest(tv); } -int tvec_claim(struct tvec_state *tv, int ok, - const char *file, unsigned lno, const char *expr, ...) +int tvec_claim_v(struct tvec_state *tv, int ok, + const char *file, unsigned lno, + const char *msg, va_list *ap) { struct adhoc_claim ck; - va_list ap; adhoc_claim_setup(tv, &ck, 0, file, lno); - if (!ok) - { va_start(ap, expr); tvec_fail_v(tv, expr, &ap); va_end(ap); } + if (!ok) tvec_fail_v(tv, msg, ap); adhoc_claim_teardown(tv, &ck); return (ok); } +int tvec_claim(struct tvec_state *tv, int ok, + const char *file, unsigned lno, const char *msg, ...) +{ + va_list ap; + + va_start(ap, msg); tvec_claim_v(tv, ok, file, lno, msg, &ap); va_end(ap); + return (ok); +} + int tvec_claimeq(struct tvec_state *tv, const struct tvec_regty *ty, const union tvec_misc *arg, const char *file, unsigned lno, const char *expr)