Azure / Azure/umock-c

STRICT_EXPECTED_CALL should also take function pointers

Open
#32 0 comments 0 reactions 0 assignees View on GitHub
bug up for grabs
Dominant language
C
Stars
36
Forks
27
Avg merge
32m
Merged PRs (30d)
3

Description

The following code is valid:
```c
MOCKABLE_FUNCTION(WINAPI, BOOL, mocked_PathFileExistsA, LPCSTR, pszPath);
...
STRICT_EXPECTED_CALL(mocked_PathFileExistsA(TEST_FOLDER));
```

The following code is NOT valid:
```c
MOCKABLE_FUNCTION(WINAPI, BOOL, mocked_PathFileExistsA, LPCSTR, pszPath);
...
static BOOL(WINAPI *pfPathFileExistsA)(LPCSTR path) = mocked_PathFileExistsA;
STRICT_EXPECTED_CALL(pfPathFileExistsA(TEST_FOLDER));
```

even when pfPathFileExists is a pointer to mocked_PathFileExistsA, the code should compile...

Best Regards,
Andrei Porumb

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the STRICT_EXPECTED_CALL macro and reproducing the difference between a direct mocked function call and the pfPathFileExistsA function-pointer call shown here. The work is done when the pointer form compiles while the existing direct-call form continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.