emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f69e2aa 3/4: * test/manual/cedet/tests/test*: More updates from u


From: Stefan Monnier
Subject: master f69e2aa 3/4: * test/manual/cedet/tests/test*: More updates from upstream
Date: Thu, 31 Oct 2019 19:06:06 -0400 (EDT)

branch: master
commit f69e2aa104209090d5487a7382473ec38b43e9c7
Author: Eric Ludlam <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * test/manual/cedet/tests/test*: More updates from upstream
    
    * test/manual/cedet/tests/testjavacomp.java,
    test/manual/cedet/tests/testnsp.cpp,
    test/manual/cedet/tests/testsppcomplete.c,
    test/manual/cedet/tests/testtypedefs.cpp,
    test/manual/cedet/tests/testvarnames.c:
    Merge content from CEDET on SF with extended test points for use with
    test/lisp/cedet/semantic-utest-ia.el
    Author: Eric Ludlam <address@hidden>
---
 test/manual/cedet/tests/testjavacomp.java |  16 ++++-
 test/manual/cedet/tests/testnsp.cpp       | 103 ++++++++++++++++++++++++++++--
 test/manual/cedet/tests/testsppcomplete.c |  36 +++++++++++
 test/manual/cedet/tests/testtypedefs.cpp  |  75 ++++++++++++++++++++++
 test/manual/cedet/tests/testvarnames.c    |  18 +++++-
 5 files changed, 238 insertions(+), 10 deletions(-)

diff --git a/test/manual/cedet/tests/testjavacomp.java 
b/test/manual/cedet/tests/testjavacomp.java
index 1102e51..d2f20f6 100644
--- a/test/manual/cedet/tests/testjavacomp.java
+++ b/test/manual/cedet/tests/testjavacomp.java
@@ -24,6 +24,10 @@ package tests.testjavacomp;
 class secondClass {
     private void scFuncOne() {    }
     public void scFuncOne() {    }
+
+    int package_protected_field;
+    public int public_protected_field;
+    private int private_protected_field;
 }
 
 
@@ -52,15 +56,21 @@ public class testjavacomp {
 
        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" )
            ;
     }
 
diff --git a/test/manual/cedet/tests/testnsp.cpp 
b/test/manual/cedet/tests/testnsp.cpp
index 012dc66..e6ffd4a 100644
--- a/test/manual/cedet/tests/testnsp.cpp
+++ b/test/manual/cedet/tests/testnsp.cpp
@@ -1,8 +1,24 @@
-// 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 <address@hidden>
+
+   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 {
 
@@ -27,3 +43,80 @@ void myfcn_not_in_ns (void) {
     ; // #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 <address@hidden>
+// 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" )
+}
diff --git a/test/manual/cedet/tests/testsppcomplete.c 
b/test/manual/cedet/tests/testsppcomplete.c
index d789994..e678076 100644
--- a/test/manual/cedet/tests/testsppcomplete.c
+++ b/test/manual/cedet/tests/testsppcomplete.c
@@ -1,3 +1,25 @@
+/* testesppcomplete.cpp --- semantic-ia-utest completion engine unit tests
+
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
+
+   Author: Eric M. Ludlam <address@hidden>
+
+   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; };
@@ -28,3 +50,17 @@ int main(int argc, char *argv[]) {
     ; // #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;
+}
diff --git a/test/manual/cedet/tests/testtypedefs.cpp 
b/test/manual/cedet/tests/testtypedefs.cpp
index 6c6628d..171086e 100644
--- a/test/manual/cedet/tests/testtypedefs.cpp
+++ b/test/manual/cedet/tests/testtypedefs.cpp
@@ -76,5 +76,80 @@ int main()
   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;
 }
diff --git a/test/manual/cedet/tests/testvarnames.c 
b/test/manual/cedet/tests/testvarnames.c
index 1cbf3c0..a7d3d3c 100644
--- a/test/manual/cedet/tests/testvarnames.c
+++ b/test/manual/cedet/tests/testvarnames.c
@@ -1,5 +1,4 @@
-/* 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.
 
@@ -19,6 +18,7 @@
 
    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 {
@@ -56,6 +56,17 @@ struct inline2struct {
 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-
@@ -87,4 +98,7 @@ int test_1(int var_arg1) {
     ; // #10# ( "named_1" "named_2")
   in_var2.// -11-
     ; // #11# ( "named_3" "named_4")
+
+  varorstruct = assign// -12-
+    ; // #12# ( "assigntovarorstruct" )
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]