Associating a clean .kdevduchain repo for unit tests

Milian Wolff mail at milianw.de
Mon Aug 31 19:13:57 UTC 2009


David Nolden, 31.08.2009:
> Am Montag 31 August 2009 13:19:22 schrieb Milian Wolff:
> > David Nolden, 31.08.2009:
> > > Am Mittwoch 26 August 2009 12:41:36 schrieb Milian Wolff:
> > > > PHP has the problem that it requires a clean .kdevduchain for unit
> > > > tests. And I'd say it would make sense for other languages as well to
> > > > always operate on a clean .kdevduchain repo in unit tests.
> > > >
> > > > Is there any way we can enfore a kdevduchain repo for unit tests?
> > > > Giving it a name like the INT_MAX value or something would make it
> > > > _very_ unlikely that it ever gets an existing repo.
> > > >
> > > > Oh and before I forget it: Unit tests can disable _writing_ to a repo
> > > > (very good!), but not disable _reading_ from a repo.
> > > > See:
> > > >      DUChain::self()->disablePersistentStorage();
> > >
> > > Maybe the simplest and cleanest solution would be also disabling the
> > > _loading_ of a repository when persistent storage is disabled.
> >
> > But that is currently not implemented, right?
>
> Yes, it's not yet implemented.

If I should implement that, I would appreciate some help:

a) should I just use thes dDUChainPrivate->m_cleanupDisabled, or should it be 
renamed then (imo it should)
b) but disablePersistentStorage is imo a good name, i.e. can stay
c) is returning 0 in the chainForDocument method(s) enough? It would be for 
PHP afaik, since that is what we check in the parsejob... But I'm unsure on 
whether that is the correct thing to do, since then a unit test like that:

- create duchain for some url
- create second duchain for another url, which e.g. includes another one by 
url => we'd need chainForDocument to return the just created duchain (but none 
that is stored on disk...)

Looking at chainForDocument with IndexedString arg, I see a comment:

    return list[0]->topContext(); //Load a top-context if there is none in 
memory

Is that the only thing we have to omit when disabling persistent storage?
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090831/c5f833fb/attachment.sig>


More information about the KDevelop-devel mailing list