You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UnityStringArgumentMatches doesn't seem to work properly for parameterized tests #779
-----------------------
0 Tests 0 Failures 0 Ignored
OK
Additional information/observations
The problem seem to be related to how the function UnityStringArgumentMatches (in unity.c on line 2412) parses the input string. In particular when the input string includes the comma character ,. The function seem to tokenize (ish) the input string using the comma character as a delimiter. I'm not sure if this is the intended behavior, but I've noticed that it causes more tests to be run when the substring pointed to by ptr1 partially matches the current test name.
The following if-test evaluates to true for other parameterized tests (not just the exact match) because the ptr1 is pointing to substring 0).
2461: /* done if complete testname match */2462: if (IsStringInBiggerString(Unity.CurrentTestName, ptr1) ==1)
2463: {
2464: return1;
2465: }
So for an input string "test_first(0,0)", I would expect Unity to only execute on exact match (with both -f and/or -n options). However, invoking the test executable as:
I'm not entirely sure if I've misunderstood the purpose of -f and -n options, but I'm currently presuming that all of this is unintended behavior. Let me know if you need more help/info.
Activity
orjangj commentedon May 1, 2025
Even
-f "test_first(0,100)", which isn't even a test case, causes a test to be triggered 😅I'm not entirely sure if I've misunderstood the purpose of
-fand-noptions, but I'm currently presuming that all of this is unintended behavior. Let me know if you need more help/info.orjangj commentedon Aug 12, 2025
Any update on this?