CMakePP / CMakeTest

A unit-testing framework for CMake functions
https://cmakepp.github.io/CMakeTest/
Apache License 2.0
10 stars 6 forks source link

Add checks to ensure test and section names do not clobber already defined units #89

Closed AutonomicPerfectionist closed 10 months ago

AutonomicPerfectionist commented 1 year ago

Is your feature request related to a problem? Please describe. When adding new tests, it's common to copy the definition of a previous test and modify the contents. However, sometimes the test writer forgets to change the name of the new section or test, and it overwrites the old test definition.

Describe the solution you'd like Inside ct_add_section, we can do a quick check to see if the given name is already a section in the parent unit.

Alternatively, we could do a cpp_type_of() to check if the function with that name is already defined, this would additionally catch any errors with the weird scoping rules.

AutonomicPerfectionist commented 11 months ago

After #91 this is less of an issue, but we can still do verification in ct_add_section by checking the sibling sections' names