From 3aa431155978c46ca3d2bcc42b6a88f77421096e Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 14 Feb 2021 21:20:00 -0500 Subject: [PATCH] nctree: test NULL callback case for real #1164 --- src/tests/tree.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/tests/tree.cpp b/src/tests/tree.cpp index f2f51a95d..9f2c1240e 100644 --- a/src/tests/tree.cpp +++ b/src/tests/tree.cpp @@ -17,7 +17,7 @@ TEST_CASE("Tree") { REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0)); // should be refused with a null items - SUBCASE("BadTreeNoPointer") { + SUBCASE("BadTreeNoItems") { struct nctree_options opts = { .items = nullptr, .count = 2, @@ -43,10 +43,17 @@ TEST_CASE("Tree") { } // should be refused with a null callback - SUBCASE("BadTreeNoCount") { + SUBCASE("BadTreeNoCallback") { + nctree_item items[] = { + { + .curry = strdup("item1"), + .subs = nullptr, + .subcount = 0, + }, + }; struct nctree_options opts = { - .items = {}, - .count = 1, + .items = items, + .count = sizeof(items) / sizeof(*items), .bchannels = 0, .nctreecb = nullptr, .flags = 0,