Skip to content

Fixing false positives for MISRA C++ 2023 Rule 6.5.1 on googletest ma…#8086

Merged
danmar merged 1 commit intodanmar:mainfrom
mueller-florian:googletest_misra-cpp-2023-6.5.1
Jan 6, 2026
Merged

Fixing false positives for MISRA C++ 2023 Rule 6.5.1 on googletest ma…#8086
danmar merged 1 commit intodanmar:mainfrom
mueller-florian:googletest_misra-cpp-2023-6.5.1

Conversation

@mueller-florian
Copy link
Contributor

When running cppcheck premium with MISRA C++2023 Rule 6.5.1 enabled on unittests using googletests with --library=googletest, cppcheck is flagging each TEST(test_suite_name, test_name) with violation of Rule 6.5.1.

The current definition of TEST(A,B) in googletest.cfg defines the function without special care, which violates the MISRA rule.

Following the original MACRO definition from googletest, the PR introduces encapsulation with a class.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 5, 2026

@mueller-florian
Copy link
Contributor Author

This is a follow-up for #8081, which didn't provide a proper fix.

@mueller-florian mueller-florian marked this pull request as ready for review January 5, 2026 15:42
@danmar danmar merged commit 4fc4f01 into danmar:main Jan 6, 2026
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants