From 94d6bc8cf977917c9a405d748378261f51bab724 Mon Sep 17 00:00:00 2001 From: jlamothe Date: Sat, 11 Nov 2023 23:08:08 +0000 Subject: [PATCH] make sure run_test() doesn't crash when handed a null state --- test/run-test.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/run-test.c b/test/run-test.c index 509d442..d582f1f 100644 --- a/test/run-test.c +++ b/test/run-test.c @@ -31,6 +31,7 @@ static void test_pass(TestState *); static void test_fail(TestState *); static void test_pend(TestState *); +static void null_state(TestState *); decl_test(always_passes); decl_test(always_fails); decl_test(always_pends); @@ -44,6 +45,7 @@ test_run_test(TestState *s) test_pass(s); test_fail(s); test_pend(s); + null_state(s); } // Internal Functions @@ -126,6 +128,14 @@ test_pend(TestState *s) ); } +static void +null_state(TestState *s) +{ + print("\tnull state\n"); + // make sure it doesn't crash + run_test(0, always_passes); +} + decl_test(always_passes) { return test_success;