Testing reading of cache
Niko Sams
niko.sams at gmail.com
Sat May 15 11:09:37 UTC 2010
On Sat, May 15, 2010 at 12:57, Esben Mose Hansen <kde at mosehansen.dk> wrote:
> 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* .
There is already a very simple implementation of IProject for tests:
tests/testproject.h
I think I used it in php some tests
Niko
More information about the KDevelop-devel
mailing list