Testing reading of cache

Esben Mose Hansen kde at mosehansen.dk
Sat May 15 10:57:04 UTC 2010


Hi,

after fixing the bug that CMakeCache.txt was not read, I wanted to make a unit 
test to cover this fairly important aspect. However, I am stumped a bit. The 
function I want to test is actully 

CMakeManager::import(KDevelop::IProject *project) 

which needs an IProject*. The only implementation of IProject is the shell's 
Project, which is basically constructed using the "open".  

Now, maybe I could set up enough test data using relative paths that this 
might actually work, by adding a project include a suitable .kdev4/*. This 
then calls the import() above in a job, and then I'd just wait for that to 
finish, if the tests sets up the machinery needed for this. I wouldn't know if 
this is at all possible.

Alternatively, and I think more usable, a new IProject implementation could be 
created, one that was basically a  group of setters and getters, such that all 
return values of the project could be controlled easily. This would not be 
hard to do, and would make it easier to test stuff involving IProject*. 
However, I would need a place to put this ProjectScaffold (or whatever it will 
be called), and it would mean that changes to IProject might need changes in 
this need implementation as well as in shell/project* .

Thoughts?


-- 
Kind regards, Esben




More information about the KDevelop-devel mailing list