From acf53d31eebfcce694c093141cf0ba6d88189263 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Fri, 20 Mar 2026 17:20:23 +0000 Subject: [PATCH] Add test case --- modules/libcom/test/macDefExpandTest.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/libcom/test/macDefExpandTest.c b/modules/libcom/test/macDefExpandTest.c index 37f11f9f4..14cec45b9 100644 --- a/modules/libcom/test/macDefExpandTest.c +++ b/modules/libcom/test/macDefExpandTest.c @@ -61,6 +61,27 @@ static void macEnvScope(void) checkMac(handle, "E", "15"); checkMac(handle, "F", NULL); + { + /* test worst case for short definitions + * https://github.com/epics-base/epics-base/pull/838 + */ + macParseDefns(NULL, "1,3,5", &defines); /* smoke */ + +#define CASE(I,V) \ + testOk(defines[I] && strcmp(defines[I], V)==0, "defines[%u] \"%s\" == \"" V "\"", I, defines[I]) + CASE(0,"1"); + testOk1(defines[1]==NULL); + CASE(2,"3"); + testOk1(defines[3]==NULL); + CASE(4,"5"); + testOk1(defines[5]==NULL); + testOk1(defines[6]==NULL); +#undef CASE + + free(defines); + defines = NULL; + } + { macPushScope(handle);