Download - HSR - Institutional Repository
Transcript
6.5.1 External Include Directories
Per default, testing projects do not contain any references to external include directories.
This also includes the C++ standard library. This makes sense because the testing
project would become machine dependent since there might be different library version
which are installed in different locations.
Nevertheless, tests are required which can validate the correct behavior of the ReDHead plugin concerning these external include directories. The refactoring test framework, on which the ReDHead testing framework is based on, however this did not provide
the possibility to specify any such external include directories. After spending a lot of
time to figure out how the CProject instance that was created in the setup phase of
the test could get added such directory paths, I found the correct way to achieve what
I desired. However, CDT’s approach to solve this problem is quiet strange.
2
private void addExternalPaths () {
String [ ] paths = new String [ ] {” / path / to / first / dir ” , ” / path / to / second / dir ” };
TestScannerProvider . sIncludes = array ;
}
5
8
@Override
protected void tearDown () throws
TestScannerProvider . clear () ;
}
Exception {
To make the testing indexer also consider the external directories I want to add, they
do not have to be added to the created instance of ICProject, but rather to the globally
accessible field TestScannerProvider.sIncludes. As can be seen in the listing, the
TestScannerProvider has to be cleared after the test was run in the tearDown method.
I think do I not have to go into detail here to show that this is not a very nice approach
to solve the problem at hand.
58