handling sw code and test suites in same code base

Is it the right approach to have the same code base for SW and TestSuites? Is it ok to have the same CI pipeline may be with different validation checks?
In general, TestSuites qualify the SW code during the validation in the CI pipeline. Ideally, TestSuite is also a code (scripts) which can be part of the same code base. In a case, where both SW code and TestSuite scripts are changed at the same time for a new feature, changed SW code is qualified by the changed TestSuite. Is this a right approach? Is there any theory which helps to handle this situation in a better way?
Please share your views/comments