class secondClass {
private void scFuncOne() { }
public void scFuncOne() { }
+
+ int package_protected_field;
+ public int public_protected_field;
+ private int private_protected_field;
}
secondClass SC;
- SC.//-3-
+ SC.s//-3-
// #3# ( "scFuncOne" )
;
+ // @TODO - to make this test complete, we need an import
+ // with a package protected field that is excluded
+ // from the completion list.
+ SC.p//-4-
+ // #4# ( "package_protected_field" "public_protected_field" )
+
nestedClass NC;
// @todo - need to fix this? I don't know if this is legal java.
- NC.// - 4-
- // #4# ( "ncFuncOne" )
+ NC.// - 5-
+ // #5# ( "ncFuncOne" )
;
}
-// Test NSP (Name space parent)
-//
-// Test dereferencing parents based on local parent scope.
-//
-// Derived from data David Engster provided.
+/* testnsp.cpp --- semantic-ia-utest completion engine unit tests
+
+ Copyright (C) 2008-2019 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/>.
+*/
namespace nsp {
; // #1# ( "fromchild" "fromroot" )
}
+// Test a class declared in a class, where the contents
+// are in a qualified name.
+//
+// Thanks Michael Reiher for the concise example.
+
+class AAA
+{
+public:
+ AAA();
+
+ void aaa();
+
+private:
+ class Private;
+ Private * const d;
+};
+
+class AAA::Private
+{
+ Private() : bbb(0) {
+ }
+
+ BBB* bbb;
+};
+
+void AAA::aaa()
+{
+ d->// -2-
+ ; // #2# ( "bbb" )
+}
+
+// #include files inside a namespace
+// David Engster <deng@randomsample.de>
+// See revisions 8034-8037 which implement this.
+
+namespace another {
+ #include "testdoublens.hpp"
+}
+
+void foo(void) {
+
+ another::// -3-
+ ; // #3# ( "Name1" "a" "stage3_Foo" )
+
+ another::Name1::Name2::Foo a;
+
+ a.// -4-
+ ; // #4# ( "Mumble" "get" )
+}
+
+// What happens if a type your looking for is scoped withing a type,
+// but you are one level into the completion so the originating scope
+// excludes the type of the variable you are completing through?
+// Thanks Martin Stein for this nice example.
+
+namespace ms_structs
+{
+ struct ms_aaa
+ {
+ int xx;
+ };
+
+ struct ms_bbb
+ {
+ struct ms_aaa yy;
+ };
+};
+
+int fun()
+{
+ using namespace ms_structs;
+ struct ms_bbb mszz;
+ int uu = mszz.// -5-
+ ; // #5# ( "yy" )
+ int kk = mszz.yy.// - 6- @TODO - bring in patch from SF
+ ; // #6# ( "xx" )
+}
+/* testesppcomplete.cpp --- semantic-ia-utest completion engine unit tests
+
+ Copyright (C) 2008-2019 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/>.
+*/
+
/* Example provided by Hannes Janetzek */
struct Test { int test; };
; // #3# ( "test" )
}
+/* Test symref and macros together. */
+
+// This function exists only so we can have a comment in a tag with this name.
+void function_with_macro_name ()
+// %1% ( ( "testsppcomplete.c" ) ( "function_with_macro_name" "function_with_macro_name" "use_macro") )
+// Note: fwmn is in twice, once for function, and once for the constant macro below.
+{
+}
+
+#define function_with_macro_name 1
+
+int use_macro () {
+ int a = function_with_macro_name;
+}
ntb.// -4-
;
// #4# ("otherFunc")
+
+ return 0;
+}
+
+// ------------------
+// Example from Yupeng.
+
+typedef struct epd_info {
+ int a;
+} epd_info_t;
+
+static int epd_probe(struct platform_device *pdev)
+{
+ struct epd_info *db;
+ epd_info_t db1;
+
+ db.// -5-
+ ; // #5# ("a")
+ db1.// -6-
+ ;// #6# ("a")
+
+ return 1;
+}
+
+// ------------------
+// Example from Michel LAFON-PUYO
+
+typedef enum
+{
+ ENUM1,
+ ENUM2
+} e_toto;
+
+typedef struct
+{
+ int field_a;
+ int field_b;
+} t_toto;
+
+// Note: Error condition from anonymous types in a typedef
+// was that the first (ie - the enum) would be used in
+// place of the struct.
+int func(void)
+{
+ t_toto t;
+ t. // -7-
+ ; // #7# ( "field_a" "field_b" )
+ return 0;
+}
+
+
+// ------------------
+// Example from Dixon Ryan
+
+
+namespace NS2 {
+ class MyClass {
+
+ public:
+ void myFunction() { }
+ };
+}
+
+typedef class NS2::MyClass* MyClassHandle;
+
+int dixon ( void ) {
+ MyClassHandle mch = getMyClassHandle();
+ NS2::MyClass* mcptr = getMyClassHandle();
+
+ mcptr-> // -8-
+ ; // #8# ( "myFunction" )
+ mch-> // - 9- TODO bring over patch from SF
+ ; // #9# ( "myFunction" )
+ deleteMyClassHandle(mch);
+
return 0;
}
-/* testvarnames.cpp
- Test variable and function names, lists of variables on one line, etc.
+/* testvarnames.cpp --- semantic-ia-utest completion engine unit tests
Copyright (C) 2008-2019 Free Software Foundation, Inc.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+
*/
struct independent {
struct inlinestruct in_var1;
struct inline2struct in_var2;
+/*
+ * Structures (or any types) could have the same name as a variable.
+ * Make sure we complete vars over types.
+ *
+ * See cedet-devel mailing list Dec 23, 2013 for details.
+ */
+struct varorstruct {};
+int varorstruct;
+
+int assigntovarorstruct;
+
int test_1(int var_arg1) {
var_// -1-
; // #10# ( "named_1" "named_2")
in_var2.// -11-
; // #11# ( "named_3" "named_4")
+
+ varorstruct = assign// -12-
+ ; // #12# ( "assigntovarorstruct" )
}