* test/lisp/cedet/semantic-utest-ia.el (ert, ert-x): Require. (cedet-utest-directory, semantic-utest-test-directory): Remove variables. (semantic-utest-ia-doublens.cpp, semantic-utest-ia-subclass.cpp) (semantic-utest-ia-typedefs.cpp, semantic-utest-ia-struct.cpp) (semantic-utest-ia-templates.cpp, semantic-utest-ia-using.cpp) (semantic-utest-ia-nsp.cpp, semantic-utest-ia-localvars.cpp) (semantic-utest-ia-namespace.cpp) (semantic-utest-ia-sppcomplete.c, semantic-utest-ia-varnames.c) (semantic-utest-ia-javacomp.java) (semantic-utest-ia-varnames.java, semantic-utest-ia-wisent.wy) (semantic-utest-ia-texi, semantic-utest-ia-make) (semantic-utest-ia-srecoder): Use 'ert-resource-file'. Don't check if file exists; we can assume that it does. * test/manual/cedet/tests/testjavacomp.java: * test/manual/cedet/tests/testlocalvars.cpp: * test/manual/cedet/tests/testnsp.cpp: * test/manual/cedet/tests/testsppcomplete.c: * test/manual/cedet/tests/teststruct.cpp: * test/manual/cedet/tests/testsubclass.cpp: * test/manual/cedet/tests/testsubclass.hh: * test/manual/cedet/tests/testtemplates.cpp: * test/manual/cedet/tests/testtypedefs.cpp: * test/manual/cedet/tests/testusing.cpp: * test/manual/cedet/tests/testusing.hh: * test/manual/cedet/tests/testvarnames.c: * test/manual/cedet/tests/testvarnames.java: * test/manual/cedet/tests/testwisent.wy: Move from here... * test/lisp/cedet/semantic-utest-ia-resources/testjavacomp.java: * test/lisp/cedet/semantic-utest-ia-resources/testlocalvars.cpp: * test/lisp/cedet/semantic-utest-ia-resources/testnsp.cpp: * test/lisp/cedet/semantic-utest-ia-resources/testsppcomplete.c: * test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp: * test/lisp/cedet/semantic-utest-ia-resources/testsubclass.cpp: * test/lisp/cedet/semantic-utest-ia-resources/testsubclass.hh: * test/lisp/cedet/semantic-utest-ia-resources/testtemplates.cpp: * test/lisp/cedet/semantic-utest-ia-resources/testtypedefs.cpp: * test/lisp/cedet/semantic-utest-ia-resources/testusing.cpp: * test/lisp/cedet/semantic-utest-ia-resources/testusing.hh: * test/lisp/cedet/semantic-utest-ia-resources/testvarnames.c: * test/lisp/cedet/semantic-utest-ia-resources/testvarnames.java: * test/lisp/cedet/semantic-utest-ia-resources/testwisent.wy: ...to here.
215 lines
3.9 KiB
C++
215 lines
3.9 KiB
C++
// testdoublens.cpp --- semantic-ia-utest completion engine unit tests
|
|
|
|
// Copyright (C) 2008-2021 Free Software Foundation, Inc.
|
|
|
|
// Author: Eric M. Ludlam <zappo@gnu.org>
|
|
|
|
// This file is part of GNU Emacs.
|
|
|
|
// GNU Emacs is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// GNU Emacs is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#include "testdoublens.hpp"
|
|
|
|
namespace Name1 {
|
|
namespace Name2 {
|
|
|
|
Foo::Foo()
|
|
{
|
|
p// -1-
|
|
// #1# ( "pMumble" "publishStuff" )
|
|
;
|
|
}
|
|
|
|
int Foo::get() // ^1^
|
|
{
|
|
p// -2-
|
|
// #2# ( "pMumble" "publishStuff" )
|
|
;
|
|
return 0;
|
|
}
|
|
|
|
void Foo::publishStuff(int a, int b) // ^2^
|
|
{
|
|
int foo = a;
|
|
int bar = b;
|
|
}
|
|
|
|
// Test polymorphism on arg types. Note that order is
|
|
// mixed to maximize failure cases
|
|
void Foo::publishStuff(char a, char b) // ^4^
|
|
{
|
|
int foo = a;
|
|
int bar = b;
|
|
}
|
|
|
|
void Foo::sendStuff(int a, int b) // ^3^
|
|
{
|
|
int foo = a;
|
|
int bar = b;
|
|
|
|
Foo::publishStuff(1,2)
|
|
|
|
}
|
|
|
|
} // namespace Name2
|
|
} // namespace Name1
|
|
|
|
// Test multiple levels of metatype expansion
|
|
int test_fcn () {
|
|
stage3_Foo MyFoo;
|
|
|
|
MyFoo.// -3-
|
|
// #3# ( "Mumble" "get" )
|
|
;
|
|
|
|
Name1::Name2::F//-4-
|
|
// #4# ( "Foo" )
|
|
;
|
|
|
|
// @TODO - get this working...
|
|
Name1::stage2_Foo::M//-5-
|
|
/// #5# ( "Mumble" )
|
|
;
|
|
}
|
|
|
|
stage3_Foo foo_fcn() {
|
|
// Can we go "up" to foo with senator-go-to-up-reference?
|
|
}
|
|
|
|
|
|
// Second test from Ravikiran Rajagopal
|
|
|
|
namespace A {
|
|
class foo {
|
|
public:
|
|
void aa();
|
|
void bb();
|
|
};
|
|
}
|
|
namespace A {
|
|
class bar {
|
|
public:
|
|
void xx();
|
|
public:
|
|
foo myFoo;
|
|
};
|
|
|
|
void bar::xx()
|
|
{
|
|
myFoo.// -6- <--- cursor is here after the dot
|
|
// #6# ( "aa" "bb" )
|
|
;
|
|
}
|
|
}
|
|
|
|
// Double namespace example from Hannu Koivisto
|
|
//
|
|
// This is tricky because the parent class "Foo" is found within the
|
|
// scope of B, so the scope calculation needs to put that together
|
|
// before searching for parents in scope.
|
|
namespace a {
|
|
namespace b {
|
|
|
|
class Bar : public Foo
|
|
{
|
|
int baz();
|
|
};
|
|
|
|
int Bar::baz()
|
|
{
|
|
return dum// -7-
|
|
// #7# ( "dumdum" )
|
|
;
|
|
}
|
|
|
|
} // namespace b
|
|
} // namespace a
|
|
|
|
// Three namespace example from Hannu Koivisto
|
|
//
|
|
// This one is special in that the name e::Foo, where "e" is in
|
|
// the scope, and not referenced from the global namespace. This
|
|
// wasn't previously handled, so the fullscope needed to be added
|
|
// to the list of things searched when in split-name decent search mode
|
|
// for scopes.
|
|
|
|
namespace d {
|
|
namespace e {
|
|
|
|
class Foo
|
|
{
|
|
public:
|
|
int write();
|
|
};
|
|
|
|
} // namespace d
|
|
} // namespace e
|
|
|
|
|
|
namespace d {
|
|
namespace f {
|
|
|
|
class Bar
|
|
{
|
|
public:
|
|
int baz();
|
|
|
|
private:
|
|
e::Foo &foo;
|
|
};
|
|
|
|
int Bar::baz()
|
|
{
|
|
return foo.w// -8-
|
|
// #8# ( "write" )
|
|
;
|
|
}
|
|
|
|
} // namespace f
|
|
} // namespace d
|
|
|
|
// Fully qualified const struct function arguments
|
|
class ContainsStruct
|
|
{
|
|
struct TheStruct
|
|
{
|
|
int memberOne;
|
|
int memberTwo;
|
|
};
|
|
};
|
|
|
|
void someFunc(const struct ContainsStruct::TheStruct *foo)
|
|
{
|
|
foo->// -9-
|
|
// #9# ("memberOne" "memberTwo")
|
|
}
|
|
|
|
// Class with structure tag
|
|
class ContainsNamedStruct
|
|
{
|
|
struct _fooStruct
|
|
{
|
|
int memberOne;
|
|
int memberTwo;
|
|
} member;
|
|
};
|
|
|
|
void someOtherFunc(void)
|
|
{
|
|
ContainsNamedStruct *someClass;
|
|
// This has to find ContainsNamedStruct::_fooStruct
|
|
someClass->member.// -10-
|
|
// #10# ("memberOne" "memberTwo")
|
|
}
|