C++ duchain unit tests

Nicolás Alvarez nicolas.alvarez at gmail.com
Thu Jun 17 22:58:16 UTC 2010


On 6/17/10, Nicolás Alvarez <nicolas.alvarez at gmail.com> wrote:
> I just found another: testDeclareUsingNamespace fails if run alone.
>
> FAIL!  : TestDUChain::testDeclareUsingNamespace() Compared values are
> not the same
>    Actual (bar->uses().count()): 0
>    Expected (1): 1
>    Loc: [kdevelop/languages/cpp/cppduchain/tests/test_duchain.cpp(2164)]
>
> You can test this by passing the test function name as an argument to
> the test tool:
> ./duchaintest.shell testDeclareUsingNamespace
>
> The test works if testLocalNamespaceAlias runs before. I haven't
> checked if only this particular test makes DeclareUsingNamespace pass,
> or if there are others.
>
> I modified testDeclareUsingNamespace to dump duchain, and when run
> alone, the foo::bar declaration indeed has zero uses; while when run
> after testLocalNamespaceAlias, there is a properly-ranged use.
>
> From looking at the tests alone, I can't figure out why it does work
> if testLocalNamespaceAlias runs first. Isn't release(top) supposed to
> cleanup enough? (I'm not yet planning to dive into the giant codebase
> of the C++ parser :P)

testLoopNamespaceImport fails in a *very* similar way when run alone.
The testcase involves "using namespace", the failure is related to
missing uses, and the problem goes away when running the test along
with others.

-- 
Nicolas




More information about the KDevelop-devel mailing list