diff options
| author | Eric Ludlam | 2019-10-27 20:51:54 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2019-10-31 19:04:12 -0400 |
| commit | f69e2aa104209090d5487a7382473ec38b43e9c7 (patch) | |
| tree | b63a2c91aab10dfdfafc83531750377c69f2a212 | |
| parent | 31ed03020c458daabdd8feac741e276a1b7f723b (diff) | |
| download | emacs-f69e2aa104209090d5487a7382473ec38b43e9c7.tar.gz emacs-f69e2aa104209090d5487a7382473ec38b43e9c7.zip | |
* 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 <zappo@gnu.org>
| -rw-r--r-- | test/manual/cedet/tests/testjavacomp.java | 16 | ||||
| -rw-r--r-- | test/manual/cedet/tests/testnsp.cpp | 103 | ||||
| -rw-r--r-- | test/manual/cedet/tests/testsppcomplete.c | 36 | ||||
| -rw-r--r-- | test/manual/cedet/tests/testtypedefs.cpp | 75 | ||||
| -rw-r--r-- | 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 1102e518918..d2f20f6f0c0 100644 --- a/test/manual/cedet/tests/testjavacomp.java +++ b/test/manual/cedet/tests/testjavacomp.java | |||
| @@ -24,6 +24,10 @@ package tests.testjavacomp; | |||
| 24 | class secondClass { | 24 | class secondClass { |
| 25 | private void scFuncOne() { } | 25 | private void scFuncOne() { } |
| 26 | public void scFuncOne() { } | 26 | public void scFuncOne() { } |
| 27 | |||
| 28 | int package_protected_field; | ||
| 29 | public int public_protected_field; | ||
| 30 | private int private_protected_field; | ||
| 27 | } | 31 | } |
| 28 | 32 | ||
| 29 | 33 | ||
| @@ -52,15 +56,21 @@ public class testjavacomp { | |||
| 52 | 56 | ||
| 53 | secondClass SC; | 57 | secondClass SC; |
| 54 | 58 | ||
| 55 | SC.//-3- | 59 | SC.s//-3- |
| 56 | // #3# ( "scFuncOne" ) | 60 | // #3# ( "scFuncOne" ) |
| 57 | ; | 61 | ; |
| 58 | 62 | ||
| 63 | // @TODO - to make this test complete, we need an import | ||
| 64 | // with a package protected field that is excluded | ||
| 65 | // from the completion list. | ||
| 66 | SC.p//-4- | ||
| 67 | // #4# ( "package_protected_field" "public_protected_field" ) | ||
| 68 | |||
| 59 | nestedClass NC; | 69 | nestedClass NC; |
| 60 | 70 | ||
| 61 | // @todo - need to fix this? I don't know if this is legal java. | 71 | // @todo - need to fix this? I don't know if this is legal java. |
| 62 | NC.// - 4- | 72 | NC.// - 5- |
| 63 | // #4# ( "ncFuncOne" ) | 73 | // #5# ( "ncFuncOne" ) |
| 64 | ; | 74 | ; |
| 65 | } | 75 | } |
| 66 | 76 | ||
diff --git a/test/manual/cedet/tests/testnsp.cpp b/test/manual/cedet/tests/testnsp.cpp index 012dc660600..e6ffd4aacbc 100644 --- a/test/manual/cedet/tests/testnsp.cpp +++ b/test/manual/cedet/tests/testnsp.cpp | |||
| @@ -1,8 +1,24 @@ | |||
| 1 | // Test NSP (Name space parent) | 1 | /* testnsp.cpp --- semantic-ia-utest completion engine unit tests |
| 2 | // | 2 | |
| 3 | // Test dereferencing parents based on local parent scope. | 3 | Copyright (C) 2008-2019 Free Software Foundation, Inc. |
| 4 | // | 4 | |
| 5 | // Derived from data David Engster provided. | 5 | Author: Eric M. Ludlam <zappo@gnu.org> |
| 6 | |||
| 7 | This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | it under the terms of the GNU General Public License as published by | ||
| 11 | the Free Software Foundation, either version 3 of the License, or | ||
| 12 | (at your option) any later version. | ||
| 13 | |||
| 14 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | GNU General Public License for more details. | ||
| 18 | |||
| 19 | You should have received a copy of the GNU General Public License | ||
| 20 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 21 | */ | ||
| 6 | 22 | ||
| 7 | namespace nsp { | 23 | namespace nsp { |
| 8 | 24 | ||
| @@ -27,3 +43,80 @@ void myfcn_not_in_ns (void) { | |||
| 27 | ; // #1# ( "fromchild" "fromroot" ) | 43 | ; // #1# ( "fromchild" "fromroot" ) |
| 28 | } | 44 | } |
| 29 | 45 | ||
| 46 | // Test a class declared in a class, where the contents | ||
| 47 | // are in a qualified name. | ||
| 48 | // | ||
| 49 | // Thanks Michael Reiher for the concise example. | ||
| 50 | |||
| 51 | class AAA | ||
| 52 | { | ||
| 53 | public: | ||
| 54 | AAA(); | ||
| 55 | |||
| 56 | void aaa(); | ||
| 57 | |||
| 58 | private: | ||
| 59 | class Private; | ||
| 60 | Private * const d; | ||
| 61 | }; | ||
| 62 | |||
| 63 | class AAA::Private | ||
| 64 | { | ||
| 65 | Private() : bbb(0) { | ||
| 66 | } | ||
| 67 | |||
| 68 | BBB* bbb; | ||
| 69 | }; | ||
| 70 | |||
| 71 | void AAA::aaa() | ||
| 72 | { | ||
| 73 | d->// -2- | ||
| 74 | ; // #2# ( "bbb" ) | ||
| 75 | } | ||
| 76 | |||
| 77 | // #include files inside a namespace | ||
| 78 | // David Engster <deng@randomsample.de> | ||
| 79 | // See revisions 8034-8037 which implement this. | ||
| 80 | |||
| 81 | namespace another { | ||
| 82 | #include "testdoublens.hpp" | ||
| 83 | } | ||
| 84 | |||
| 85 | void foo(void) { | ||
| 86 | |||
| 87 | another::// -3- | ||
| 88 | ; // #3# ( "Name1" "a" "stage3_Foo" ) | ||
| 89 | |||
| 90 | another::Name1::Name2::Foo a; | ||
| 91 | |||
| 92 | a.// -4- | ||
| 93 | ; // #4# ( "Mumble" "get" ) | ||
| 94 | } | ||
| 95 | |||
| 96 | // What happens if a type your looking for is scoped withing a type, | ||
| 97 | // but you are one level into the completion so the originating scope | ||
| 98 | // excludes the type of the variable you are completing through? | ||
| 99 | // Thanks Martin Stein for this nice example. | ||
| 100 | |||
| 101 | namespace ms_structs | ||
| 102 | { | ||
| 103 | struct ms_aaa | ||
| 104 | { | ||
| 105 | int xx; | ||
| 106 | }; | ||
| 107 | |||
| 108 | struct ms_bbb | ||
| 109 | { | ||
| 110 | struct ms_aaa yy; | ||
| 111 | }; | ||
| 112 | }; | ||
| 113 | |||
| 114 | int fun() | ||
| 115 | { | ||
| 116 | using namespace ms_structs; | ||
| 117 | struct ms_bbb mszz; | ||
| 118 | int uu = mszz.// -5- | ||
| 119 | ; // #5# ( "yy" ) | ||
| 120 | int kk = mszz.yy.// - 6- @TODO - bring in patch from SF | ||
| 121 | ; // #6# ( "xx" ) | ||
| 122 | } | ||
diff --git a/test/manual/cedet/tests/testsppcomplete.c b/test/manual/cedet/tests/testsppcomplete.c index d7899942285..e6780767cdb 100644 --- a/test/manual/cedet/tests/testsppcomplete.c +++ b/test/manual/cedet/tests/testsppcomplete.c | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | /* testesppcomplete.cpp --- semantic-ia-utest completion engine unit tests | ||
| 2 | |||
| 3 | Copyright (C) 2008-2019 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | Author: Eric M. Ludlam <zappo@gnu.org> | ||
| 6 | |||
| 7 | This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | it under the terms of the GNU General Public License as published by | ||
| 11 | the Free Software Foundation, either version 3 of the License, or | ||
| 12 | (at your option) any later version. | ||
| 13 | |||
| 14 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | GNU General Public License for more details. | ||
| 18 | |||
| 19 | You should have received a copy of the GNU General Public License | ||
| 20 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 21 | */ | ||
| 22 | |||
| 1 | /* Example provided by Hannes Janetzek */ | 23 | /* Example provided by Hannes Janetzek */ |
| 2 | 24 | ||
| 3 | struct Test { int test; }; | 25 | struct Test { int test; }; |
| @@ -28,3 +50,17 @@ int main(int argc, char *argv[]) { | |||
| 28 | ; // #3# ( "test" ) | 50 | ; // #3# ( "test" ) |
| 29 | } | 51 | } |
| 30 | 52 | ||
| 53 | /* Test symref and macros together. */ | ||
| 54 | |||
| 55 | // This function exists only so we can have a comment in a tag with this name. | ||
| 56 | void function_with_macro_name () | ||
| 57 | // %1% ( ( "testsppcomplete.c" ) ( "function_with_macro_name" "function_with_macro_name" "use_macro") ) | ||
| 58 | // Note: fwmn is in twice, once for function, and once for the constant macro below. | ||
| 59 | { | ||
| 60 | } | ||
| 61 | |||
| 62 | #define function_with_macro_name 1 | ||
| 63 | |||
| 64 | int use_macro () { | ||
| 65 | int a = function_with_macro_name; | ||
| 66 | } | ||
diff --git a/test/manual/cedet/tests/testtypedefs.cpp b/test/manual/cedet/tests/testtypedefs.cpp index 6c6628ddf40..171086e5a4b 100644 --- a/test/manual/cedet/tests/testtypedefs.cpp +++ b/test/manual/cedet/tests/testtypedefs.cpp | |||
| @@ -76,5 +76,80 @@ int main() | |||
| 76 | ntb.// -4- | 76 | ntb.// -4- |
| 77 | ; | 77 | ; |
| 78 | // #4# ("otherFunc") | 78 | // #4# ("otherFunc") |
| 79 | |||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | |||
| 83 | // ------------------ | ||
| 84 | // Example from Yupeng. | ||
| 85 | |||
| 86 | typedef struct epd_info { | ||
| 87 | int a; | ||
| 88 | } epd_info_t; | ||
| 89 | |||
| 90 | static int epd_probe(struct platform_device *pdev) | ||
| 91 | { | ||
| 92 | struct epd_info *db; | ||
| 93 | epd_info_t db1; | ||
| 94 | |||
| 95 | db.// -5- | ||
| 96 | ; // #5# ("a") | ||
| 97 | db1.// -6- | ||
| 98 | ;// #6# ("a") | ||
| 99 | |||
| 100 | return 1; | ||
| 101 | } | ||
| 102 | |||
| 103 | // ------------------ | ||
| 104 | // Example from Michel LAFON-PUYO | ||
| 105 | |||
| 106 | typedef enum | ||
| 107 | { | ||
| 108 | ENUM1, | ||
| 109 | ENUM2 | ||
| 110 | } e_toto; | ||
| 111 | |||
| 112 | typedef struct | ||
| 113 | { | ||
| 114 | int field_a; | ||
| 115 | int field_b; | ||
| 116 | } t_toto; | ||
| 117 | |||
| 118 | // Note: Error condition from anonymous types in a typedef | ||
| 119 | // was that the first (ie - the enum) would be used in | ||
| 120 | // place of the struct. | ||
| 121 | int func(void) | ||
| 122 | { | ||
| 123 | t_toto t; | ||
| 124 | t. // -7- | ||
| 125 | ; // #7# ( "field_a" "field_b" ) | ||
| 126 | return 0; | ||
| 127 | } | ||
| 128 | |||
| 129 | |||
| 130 | // ------------------ | ||
| 131 | // Example from Dixon Ryan | ||
| 132 | |||
| 133 | |||
| 134 | namespace NS2 { | ||
| 135 | class MyClass { | ||
| 136 | |||
| 137 | public: | ||
| 138 | void myFunction() { } | ||
| 139 | }; | ||
| 140 | } | ||
| 141 | |||
| 142 | typedef class NS2::MyClass* MyClassHandle; | ||
| 143 | |||
| 144 | int dixon ( void ) { | ||
| 145 | MyClassHandle mch = getMyClassHandle(); | ||
| 146 | NS2::MyClass* mcptr = getMyClassHandle(); | ||
| 147 | |||
| 148 | mcptr-> // -8- | ||
| 149 | ; // #8# ( "myFunction" ) | ||
| 150 | mch-> // - 9- TODO bring over patch from SF | ||
| 151 | ; // #9# ( "myFunction" ) | ||
| 152 | deleteMyClassHandle(mch); | ||
| 153 | |||
| 79 | return 0; | 154 | return 0; |
| 80 | } | 155 | } |
diff --git a/test/manual/cedet/tests/testvarnames.c b/test/manual/cedet/tests/testvarnames.c index 1cbf3c02c40..a7d3d3cb19c 100644 --- a/test/manual/cedet/tests/testvarnames.c +++ b/test/manual/cedet/tests/testvarnames.c | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | /* testvarnames.cpp | 1 | /* testvarnames.cpp --- semantic-ia-utest completion engine unit tests |
| 2 | Test variable and function names, lists of variables on one line, etc. | ||
| 3 | 2 | ||
| 4 | Copyright (C) 2008-2019 Free Software Foundation, Inc. | 3 | Copyright (C) 2008-2019 Free Software Foundation, Inc. |
| 5 | 4 | ||
| @@ -19,6 +18,7 @@ | |||
| 19 | 18 | ||
| 20 | You should have received a copy of the GNU General Public License | 19 | You should have received a copy of the GNU General Public License |
| 21 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | 20 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. |
| 21 | |||
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | struct independent { | 24 | struct independent { |
| @@ -56,6 +56,17 @@ struct inline2struct { | |||
| 56 | struct inlinestruct in_var1; | 56 | struct inlinestruct in_var1; |
| 57 | struct inline2struct in_var2; | 57 | struct inline2struct in_var2; |
| 58 | 58 | ||
| 59 | /* | ||
| 60 | * Structures (or any types) could have the same name as a variable. | ||
| 61 | * Make sure we complete vars over types. | ||
| 62 | * | ||
| 63 | * See cedet-devel mailing list Dec 23, 2013 for details. | ||
| 64 | */ | ||
| 65 | struct varorstruct {}; | ||
| 66 | int varorstruct; | ||
| 67 | |||
| 68 | int assigntovarorstruct; | ||
| 69 | |||
| 59 | int test_1(int var_arg1) { | 70 | int test_1(int var_arg1) { |
| 60 | 71 | ||
| 61 | var_// -1- | 72 | var_// -1- |
| @@ -87,4 +98,7 @@ int test_1(int var_arg1) { | |||
| 87 | ; // #10# ( "named_1" "named_2") | 98 | ; // #10# ( "named_1" "named_2") |
| 88 | in_var2.// -11- | 99 | in_var2.// -11- |
| 89 | ; // #11# ( "named_3" "named_4") | 100 | ; // #11# ( "named_3" "named_4") |
| 101 | |||
| 102 | varorstruct = assign// -12- | ||
| 103 | ; // #12# ( "assigntovarorstruct" ) | ||
| 90 | } | 104 | } |