diff --git a/9unit.c b/9unit.c index 5acb042..cc7f66c 100644 --- a/9unit.c +++ b/9unit.c @@ -27,20 +27,12 @@ // Internal Types -typedef struct RunTestWith RunTestWith; typedef struct ContextData ContextData; typedef struct SingleTestContext SingleTestContext; typedef struct TestContextWith TestContextWith; typedef struct SingleTestContextWith SingleTestContextWith; typedef struct CheckValue CheckValue; -struct RunTestWith -{ - void *ptr; // state's prevoius ptr value - TestResult (*test)(TestState *, void *); // the test - void *val; // the value being passed in -}; - struct ContextData { const char *old_c; // previous context @@ -130,14 +122,7 @@ run_test_with( void *val // the value being passed in ) { - if (!s) return; - if (!test) run_test(s, 0); - RunTestWith d; - d.ptr = s->ptr; - d.test = test; - d.val = val; - s->ptr = &d; - run_test(s, run_test_with_test); + single_test_context_with(s, 0, test, val); } void @@ -332,14 +317,6 @@ report(const char *str) print("%s", str); } -static TestResult -run_test_with_test(TestState *s) -{ - RunTestWith *d = s->ptr; - s->ptr = d->ptr; - return (*d->test)(s, d->val); -} - static void build_new_context(TestState *s, ContextData *cd) {