diff --git a/src/std/chemical.c b/src/std/chemical.c index 4cb3578..0b3a280 100644 --- a/src/std/chemical.c +++ b/src/std/chemical.c @@ -431,8 +431,25 @@ void ARC_ChemicalData_RunGroupTag(ARC_ParserTagToken *tagToken, ARC_Chemical *ch //check if removing if(chemical->load == ARC_False){ - //TODO: check if the group is empty and remove it if it is - ARC_String_Destroy(groupVariable); + /* ~ ~ */ + childTagToken = (ARC_ParserTagToken *)ARC_Vector_Get(tagToken->tagTokens, 6); + + // -> | LAMBDA + if(childTagToken->token == NULL && ARC_Vector_GetSize(childTagToken->tagTokens) == 2){ + ARC_ParserTagToken *variableLines = (ARC_ParserTagToken *)ARC_Vector_Get(childTagToken->tagTokens, 1); + ARC_ChemicalData_RunVariableLinesTag(variableLines, chemical); + + //log error if it happens + if(arc_errno != 0){ + ARC_DEBUG_LOG_ERROR("ARC_ChemicalData_RunGroupTag(tagToken, chemical), chemical errored when trying to used parsed data for variable lines"); + } + } + + //remove an empty hashtable if it is now empty + if(ARC_Hashtable_GetSize(chemical->groups)){ + ARC_String_Destroy(groupVariable); + } + return; } diff --git a/tests/std/chemical.c b/tests/std/chemical.c index 319b63e..32e5045 100644 --- a/tests/std/chemical.c +++ b/tests/std/chemical.c @@ -81,6 +81,11 @@ ARC_TEST(Chemical_BasicTest){ int32_t testVal = *(int32_t *)ARC_Chemical_GetWithCStr(chemical, "test::test"); ARC_CHECK(testVal == 5); + ARC_Chemical_UnloadFromFile(chemical, tempString); + + void *nullVal = ARC_Chemical_GetWithCStr(chemical, "test::test"); + ARC_CHECK(nullVal == NULL); + //cleanup ARC_String_Destroy(tempString); ARC_Chemical_Destroy(chemical);