diff options
| author | Eric Ludlam | 2019-10-27 20:31:34 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2019-10-31 19:01:08 -0400 |
| commit | 0f7163ab89cc6158dbb7a382b67da5ce200f42f1 (patch) | |
| tree | 4109343b6a39d7955c6d4f6b0f2f7ec4b4606dda | |
| parent | fd1b720028064c2566ff4dcc3ad898346a0f6b77 (diff) | |
| download | emacs-0f7163ab89cc6158dbb7a382b67da5ce200f42f1.tar.gz emacs-0f7163ab89cc6158dbb7a382b67da5ce200f42f1.zip | |
* test/manual/cedet/tests/: New files for semantic-utest-ia.el
* test/manual/cedet/tests/test.mk,
test/manual/cedet/tests/test.srt, test/manual/cedet/tests/test.texi,
test/manual/cedet/tests/testlocalvars.cpp,
test/manual/cedet/tests/teststruct.cpp,
test/manual/cedet/tests/testtemplates.cpp,
test/manual/cedet/tests/testusing.cpp,
test/manual/cedet/tests/testusing.hh,
test/manual/cedet/tests/testvarnames.java.
test/manual/cedet/tests/testwisent.wy:
New files to be used by test/lisp/cedet/semantic-utest-ia.el.
Author: Eric Ludlam <zappo@gnu.org>
| -rw-r--r-- | test/manual/cedet/tests/test.mk | 18 | ||||
| -rw-r--r-- | test/manual/cedet/tests/test.srt | 64 | ||||
| -rw-r--r-- | test/manual/cedet/tests/test.texi | 40 | ||||
| -rw-r--r-- | test/manual/cedet/tests/testlocalvars.cpp | 54 | ||||
| -rw-r--r-- | test/manual/cedet/tests/teststruct.cpp | 86 | ||||
| -rw-r--r-- | test/manual/cedet/tests/testtemplates.cpp | 149 | ||||
| -rw-r--r-- | test/manual/cedet/tests/testusing.cpp | 265 | ||||
| -rw-r--r-- | test/manual/cedet/tests/testusing.hh | 176 | ||||
| -rw-r--r-- | test/manual/cedet/tests/testvarnames.java | 60 | ||||
| -rw-r--r-- | test/manual/cedet/tests/testwisent.wy | 85 |
10 files changed, 997 insertions, 0 deletions
diff --git a/test/manual/cedet/tests/test.mk b/test/manual/cedet/tests/test.mk new file mode 100644 index 00000000000..edea97e7b98 --- /dev/null +++ b/test/manual/cedet/tests/test.mk | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | # A Test Makefile. -*-makefile-*- | ||
| 2 | |||
| 3 | # This test is for a file in this test directory. Just a random one. | ||
| 4 | FILES=testdoub # -1- | ||
| 5 | # #1# ("testdoublens.cpp" "testdoublens.hpp" ) | ||
| 6 | |||
| 7 | all: optional | ||
| 8 | |||
| 9 | # This one completes on a variable name. | ||
| 10 | optional: $FIL # -2- | ||
| 11 | # #2# ("FILES") | ||
| 12 | compile $@ | ||
| 13 | |||
| 14 | notoptional: opt # -3- | ||
| 15 | # #3# ("optional") | ||
| 16 | echo "Done." | ||
| 17 | |||
| 18 | #end | ||
diff --git a/test/manual/cedet/tests/test.srt b/test/manual/cedet/tests/test.srt new file mode 100644 index 00000000000..b77cd4fbe29 --- /dev/null +++ b/test/manual/cedet/tests/test.srt | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | ;; test.srt --- unit test support file for semantic-utest-ia | ||
| 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 | |||
| 23 | set mode "c++-mode" | ||
| 24 | set escape_start "{{" | ||
| 25 | set escape_end "}}" | ||
| 26 | |||
| 27 | context file | ||
| 28 | |||
| 29 | template class :blank | ||
| 30 | "A test template for emacs lisp" | ||
| 31 | ---- | ||
| 32 | ---- | ||
| 33 | |||
| 34 | template classic :blank | ||
| 35 | "A test template for emacs lisp" | ||
| 36 | ---- | ||
| 37 | ---- | ||
| 38 | |||
| 39 | template variable :blank | ||
| 40 | "A test template for emacs lisp" | ||
| 41 | ---- | ||
| 42 | ---- | ||
| 43 | |||
| 44 | template function :blank | ||
| 45 | "A test template for emacs lisp" | ||
| 46 | ---- | ||
| 47 | ---- | ||
| 48 | |||
| 49 | template testarea :blank | ||
| 50 | "A test template for emacs lisp" | ||
| 51 | ---- | ||
| 52 | {{<A:cla}} -1- | ||
| 53 | }} #1# ( "class" "classic" ) | ||
| 54 | {{^}} | ||
| 55 | |||
| 56 | {{/A}} | ||
| 57 | ---- | ||
| 58 | |||
| 59 | ;; This is a bad hack - In order for the text to parse, but also get a completion | ||
| 60 | ;; monicker into the right spot, we need to pretend a comment is the same as the | ||
| 61 | ;; escape_end. | ||
| 62 | ;; Local variables: | ||
| 63 | ;; comment-start-skip: "}}" | ||
| 64 | ;; End: | ||
diff --git a/test/manual/cedet/tests/test.texi b/test/manual/cedet/tests/test.texi new file mode 100644 index 00000000000..37d303c8b48 --- /dev/null +++ b/test/manual/cedet/tests/test.texi | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | \input texinfo | ||
| 2 | @setfilename test.info | ||
| 3 | @set TITLE TEST | ||
| 4 | @set AUTHOR Eric Ludlam | ||
| 5 | @settitle @value{TITLE} | ||
| 6 | |||
| 7 | @ifinfo | ||
| 8 | @format | ||
| 9 | START-INFO-DIR-ENTRY | ||
| 10 | * test: (test). TEST | ||
| 11 | END-INFO-DIR-ENTRY | ||
| 12 | @end format | ||
| 13 | @end ifinfo | ||
| 14 | |||
| 15 | @titlepage | ||
| 16 | @sp 10 | ||
| 17 | @center @titlefont{test} | ||
| 18 | @vskip 0pt plus 1 fill | ||
| 19 | Copyright @copyright{} 2015 Eric Ludlam | ||
| 20 | @end titlepage | ||
| 21 | |||
| 22 | @node Top | ||
| 23 | @top @value{TITLE} | ||
| 24 | |||
| 25 | This is a simple manual filled with stuff that should test completion in texinfo mode. | ||
| 26 | |||
| 27 | @m@c -1- | ||
| 28 | @c #1# ( "@majorheading" "@macro" "@menu" "@multitable" ) | ||
| 29 | |||
| 30 | @menu | ||
| 31 | * Index:: | ||
| 32 | @end menu | ||
| 33 | |||
| 34 | |||
| 35 | @node Index | ||
| 36 | @chapter Index | ||
| 37 | |||
| 38 | @contents | ||
| 39 | |||
| 40 | @bye | ||
diff --git a/test/manual/cedet/tests/testlocalvars.cpp b/test/manual/cedet/tests/testlocalvars.cpp new file mode 100644 index 00000000000..8d22c09eab1 --- /dev/null +++ b/test/manual/cedet/tests/testlocalvars.cpp | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | // testlocalvars.java --- Semantic unit test for Java | ||
| 2 | |||
| 3 | // Copyright (C) 2009-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 | |||
| 23 | class foo { | ||
| 24 | foo *member; | ||
| 25 | char anArray[10]; | ||
| 26 | }; | ||
| 27 | |||
| 28 | void func() | ||
| 29 | { | ||
| 30 | foo local1; | ||
| 31 | foo* local2 = localvar.member; | ||
| 32 | foo* local3 = new foo(); | ||
| 33 | foo local4[10]; | ||
| 34 | char local5[5] = {'1','2','3','4','5'}; | ||
| 35 | char *local6 = "12345"; | ||
| 36 | char local7 = local.anArray[0]; | ||
| 37 | char local8 = true ? 10 : 11 ; | ||
| 38 | |||
| 39 | // Check that all of the above was parsed | ||
| 40 | local//-1- | ||
| 41 | ; //#1# ("local1" "local2" "local3" "local4" "local5" "local6" "local7" "local8" ) | ||
| 42 | |||
| 43 | local1.//-2- | ||
| 44 | ; //#2# ("anArray" "member") | ||
| 45 | |||
| 46 | local2->//-3- | ||
| 47 | ; //#3# ("anArray" "member") | ||
| 48 | |||
| 49 | local3->//-4- | ||
| 50 | ; //#4# ("anArray" "member") | ||
| 51 | |||
| 52 | local4[0].//-5- | ||
| 53 | ; //#5# ("anArray" "member") | ||
| 54 | } | ||
diff --git a/test/manual/cedet/tests/teststruct.cpp b/test/manual/cedet/tests/teststruct.cpp new file mode 100644 index 00000000000..041483d1195 --- /dev/null +++ b/test/manual/cedet/tests/teststruct.cpp | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | // teststruct.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 | |||
| 23 | // Note: initially provided by by Alex Ott. | ||
| 24 | |||
| 25 | template <typename DerivedT> | ||
| 26 | struct grammar { | ||
| 27 | public: | ||
| 28 | typedef grammar<DerivedT> self_t; | ||
| 29 | typedef DerivedT const& embed_t; | ||
| 30 | grammar() {} | ||
| 31 | ~grammar() { } | ||
| 32 | void use_parser() const { } | ||
| 33 | void test1() { } | ||
| 34 | }; | ||
| 35 | |||
| 36 | struct PDFbool_parser : public grammar<PDFbool_parser> { | ||
| 37 | PDFbool_parser() {} | ||
| 38 | template <typename scannerT> struct definition { | ||
| 39 | typedef typename scannerT::iterator_t iterator_t; | ||
| 40 | int top; | ||
| 41 | definition(const PDFbool_parser& /*self*/) { | ||
| 42 | return ; | ||
| 43 | } | ||
| 44 | const int start() const { | ||
| 45 | return top; | ||
| 46 | } | ||
| 47 | }; | ||
| 48 | }; | ||
| 49 | |||
| 50 | int main(void) { | ||
| 51 | PDFbool_parser PDFbool_p = PDFbool_parser(); | ||
| 52 | PDFbool_p.//-1- | ||
| 53 | ; | ||
| 54 | // #1# ("definition" "embed_t" "self_t" "test1" "use_parser") | ||
| 55 | } | ||
| 56 | |||
| 57 | // ---------------------------------------------------------------------- | ||
| 58 | |||
| 59 | template <class Derived> struct Base { | ||
| 60 | public: | ||
| 61 | void interface() | ||
| 62 | { | ||
| 63 | // ... | ||
| 64 | static_cast<Derived*>(this)->implementation(); | ||
| 65 | // ... | ||
| 66 | } | ||
| 67 | |||
| 68 | static void static_func() | ||
| 69 | { | ||
| 70 | // ... | ||
| 71 | Derived::static_sub_func(); | ||
| 72 | // ... | ||
| 73 | } | ||
| 74 | }; | ||
| 75 | |||
| 76 | struct Derived : Base<Derived> { | ||
| 77 | void implementation() { } | ||
| 78 | static void static_sub_func() { } | ||
| 79 | }; | ||
| 80 | |||
| 81 | int foo () { | ||
| 82 | Derived d; | ||
| 83 | d.//-2- | ||
| 84 | ; | ||
| 85 | // #2# ("implementation" "interface" "static_func" "static_sub_func") | ||
| 86 | } | ||
diff --git a/test/manual/cedet/tests/testtemplates.cpp b/test/manual/cedet/tests/testtemplates.cpp new file mode 100644 index 00000000000..18ee9ec10be --- /dev/null +++ b/test/manual/cedet/tests/testtemplates.cpp | |||
| @@ -0,0 +1,149 @@ | |||
| 1 | // testtemplates.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 | |||
| 23 | // TODO - this probably means can't be part of emacs, as I don't know who this guy is. | ||
| 24 | // Written by 'Raf' | ||
| 25 | |||
| 26 | template <class T, int U, class V> | ||
| 27 | class read_ref { | ||
| 28 | public: | ||
| 29 | const T* read_ref_member_one( T); | ||
| 30 | const V* read_ref_member_two(); | ||
| 31 | }; | ||
| 32 | |||
| 33 | namespace NS { | ||
| 34 | template <class T, int U, class V> | ||
| 35 | class ref { | ||
| 36 | public: | ||
| 37 | read_ref<T,10,V> operator->() { | ||
| 38 | m_// -1- | ||
| 39 | ; | ||
| 40 | // #1# ( "m_datas" ) | ||
| 41 | } | ||
| 42 | |||
| 43 | private: | ||
| 44 | T m_datas[U]; | ||
| 45 | }; | ||
| 46 | |||
| 47 | } | ||
| 48 | |||
| 49 | class FooOne { | ||
| 50 | public: | ||
| 51 | int fooOneMember(); | ||
| 52 | }; | ||
| 53 | |||
| 54 | class FooTwo { | ||
| 55 | public: | ||
| 56 | int fooTwoMember(); | ||
| 57 | }; | ||
| 58 | |||
| 59 | class FooThree { | ||
| 60 | public: | ||
| 61 | int fooThreeMember(); | ||
| 62 | |||
| 63 | FooOne * operator->(); | ||
| 64 | }; | ||
| 65 | |||
| 66 | typedef ref<FooOne, 10,FooTwo> Test; | ||
| 67 | |||
| 68 | using NS; | ||
| 69 | |||
| 70 | void | ||
| 71 | main(void) { | ||
| 72 | ref<FooOne, 10, FooTwo> v; | ||
| 73 | |||
| 74 | v->read_ref_member_one()-> // -2- | ||
| 75 | ; | ||
| 76 | // #2# ( "fooOneMember" ) | ||
| 77 | |||
| 78 | v->read_ref_member_two()-> // -3- | ||
| 79 | ; | ||
| 80 | // #3# ( "fooTwoMember" ) | ||
| 81 | |||
| 82 | v-> // -4- | ||
| 83 | ; | ||
| 84 | // #4# ( "read_ref_member_one" "read_ref_member_two" ) | ||
| 85 | |||
| 86 | Test t; | ||
| 87 | |||
| 88 | t->read_ref_member_two()-> // -5- | ||
| 89 | ; | ||
| 90 | // #5# ( "fooTwoMember" ) | ||
| 91 | |||
| 92 | ref<FooOne, 10, FooThree> v2; | ||
| 93 | |||
| 94 | v2->read_ref_member_two()-> // -6- | ||
| 95 | ; | ||
| 96 | // #6# ( "fooOneMember" ) | ||
| 97 | |||
| 98 | /* Try all these things by also specifying the namespace in the name. */ | ||
| 99 | NS::ref<FooOne, 10, FooTwo> v3; | ||
| 100 | |||
| 101 | v3->read_ref_member_one()-> // -7- | ||
| 102 | ; | ||
| 103 | // #7# ( "fooOneMember" ) | ||
| 104 | |||
| 105 | v3->read_ref_member_two()-> // -8- | ||
| 106 | ; | ||
| 107 | // #8# ( "fooTwoMember" ) | ||
| 108 | |||
| 109 | v3->read_ref_member_two// @1@ 5 | ||
| 110 | ; | ||
| 111 | |||
| 112 | } | ||
| 113 | |||
| 114 | // More Namespace Magic using member constants. | ||
| 115 | |||
| 116 | template<typename T> | ||
| 117 | struct isFooLike { | ||
| 118 | static const bool value = false; | ||
| 119 | }; | ||
| 120 | |||
| 121 | template <> | ||
| 122 | struct isFooLike<int> { | ||
| 123 | static const bool value = true; | ||
| 124 | }; | ||
| 125 | |||
| 126 | |||
| 127 | template <typename T, bool isFoo> | ||
| 128 | class A { | ||
| 129 | public: | ||
| 130 | A(); | ||
| 131 | void foo() {}; | ||
| 132 | }; | ||
| 133 | |||
| 134 | |||
| 135 | template <typename T> | ||
| 136 | class FooFour : public A<T, isPodLike<T>::value> { | ||
| 137 | public: | ||
| 138 | bool bar() {} | ||
| 139 | }; | ||
| 140 | |||
| 141 | |||
| 142 | int main2() { | ||
| 143 | |||
| 144 | FooFour<int> ff; | ||
| 145 | |||
| 146 | ff.// - 9- @ TODO - bring over patch from SF | ||
| 147 | ; // #9# ( "bar" "foo" ); | ||
| 148 | |||
| 149 | } | ||
diff --git a/test/manual/cedet/tests/testusing.cpp b/test/manual/cedet/tests/testusing.cpp new file mode 100644 index 00000000000..1208c81fc36 --- /dev/null +++ b/test/manual/cedet/tests/testusing.cpp | |||
| @@ -0,0 +1,265 @@ | |||
| 1 | // testusing.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 | |||
| 23 | #include <adstdio.h> | ||
| 24 | |||
| 25 | #include <testusing.hh> | ||
| 26 | |||
| 27 | namespace moose { | ||
| 28 | |||
| 29 | class MyClass; | ||
| 30 | class Point; | ||
| 31 | |||
| 32 | typedef MyClass snerk; | ||
| 33 | } | ||
| 34 | |||
| 35 | namespace moose { | ||
| 36 | |||
| 37 | class Point; | ||
| 38 | class MyClass; | ||
| 39 | |||
| 40 | } | ||
| 41 | |||
| 42 | namespace { | ||
| 43 | |||
| 44 | int global_variable = 0; | ||
| 45 | |||
| 46 | }; | ||
| 47 | |||
| 48 | using moose::MyClass; | ||
| 49 | |||
| 50 | void someFcn() { | ||
| 51 | |||
| 52 | MyClass f; | ||
| 53 | |||
| 54 | f.//-1- | ||
| 55 | ; //#1# ( "getVal" "setVal" ) | ||
| 56 | |||
| 57 | } | ||
| 58 | |||
| 59 | // Code from Zhiqiu Kong | ||
| 60 | |||
| 61 | namespace panda { | ||
| 62 | |||
| 63 | using namespace bread_name; | ||
| 64 | |||
| 65 | int func() | ||
| 66 | { | ||
| 67 | bread test; | ||
| 68 | test.//-2- | ||
| 69 | ;// #2# ( "geta" ) | ||
| 70 | return 0; | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | namespace togglemoose { | ||
| 75 | |||
| 76 | MyOtherClass::testToggle1() { //^1^ | ||
| 77 | // Impl for testToggle1 | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | togglemoose::MyOtherClass::testToggle2() { //^3^ | ||
| 82 | // Impl for testToggle2 | ||
| 83 | } | ||
| 84 | |||
| 85 | using togglemoose; | ||
| 86 | |||
| 87 | MyOtherClass::testToggle3() { //^3^ | ||
| 88 | // Impl for testToggle3 | ||
| 89 | } | ||
| 90 | |||
| 91 | // Local using statements and aliased types | ||
| 92 | // Code from David Engster | ||
| 93 | |||
| 94 | void func2() | ||
| 95 | { | ||
| 96 | using namespace somestuff; | ||
| 97 | OneClass f; | ||
| 98 | f.//-3- | ||
| 99 | ; //#3# ( "aFunc" "anInt" ) | ||
| 100 | } | ||
| 101 | |||
| 102 | void func3() | ||
| 103 | { | ||
| 104 | using somestuff::OneClass; | ||
| 105 | OneClass f; | ||
| 106 | f.//-4- | ||
| 107 | ; //#4# ( "aFunc" "anInt" ) | ||
| 108 | } | ||
| 109 | |||
| 110 | // Dereferencing alias types created through 'using' statements | ||
| 111 | |||
| 112 | // Alias with fully qualified name | ||
| 113 | void func4() | ||
| 114 | { | ||
| 115 | otherstuff::OneClass f; | ||
| 116 | f. //-5- | ||
| 117 | ; //#5# ( "aFunc" "anInt" ) | ||
| 118 | } | ||
| 119 | |||
| 120 | // Alias through namespace directive | ||
| 121 | void func5() | ||
| 122 | { | ||
| 123 | using namespace otherstuff; | ||
| 124 | OneClass f; | ||
| 125 | f. //-6- | ||
| 126 | ; //#6# ( "aFunc" "anInt" ) | ||
| 127 | } | ||
| 128 | |||
| 129 | // Check name hiding | ||
| 130 | void func6() | ||
| 131 | { | ||
| 132 | using namespace morestuff; | ||
| 133 | OneClass f; // Alias for somestuff::OneClass | ||
| 134 | f. //-7- | ||
| 135 | ; //#7# ( "aFunc" "anInt" ) | ||
| 136 | aStruct g; // This however is morestuff::aStruct ! | ||
| 137 | g. //-8- | ||
| 138 | ; //#8# ( "anotherBar" "anotherFoo" ) | ||
| 139 | } | ||
| 140 | |||
| 141 | // Alias of an alias | ||
| 142 | // Currently doesn't work interactively for some reason. | ||
| 143 | void func6() | ||
| 144 | { | ||
| 145 | using namespace evenmorestuff; | ||
| 146 | OneClass f; | ||
| 147 | f. //-7- | ||
| 148 | ; //#7# ( "aFunc" "anInt" ) | ||
| 149 | } | ||
| 150 | |||
| 151 | // Alias for struct in nested namespace, fully qualified | ||
| 152 | void func7() | ||
| 153 | { | ||
| 154 | outer::StructNested f; | ||
| 155 | f.//-8- | ||
| 156 | ; //#8# ( "one" "two" ) | ||
| 157 | } | ||
| 158 | |||
| 159 | // Alias for nested namespace | ||
| 160 | void func8() | ||
| 161 | { | ||
| 162 | using namespace outerinner; | ||
| 163 | StructNested f; | ||
| 164 | AnotherStruct g; | ||
| 165 | f.//-9- | ||
| 166 | ; //#9# ( "one" "two" ) | ||
| 167 | g.//-10- | ||
| 168 | ; //#10# ( "four" "three" ) | ||
| 169 | } | ||
| 170 | |||
| 171 | // Check convetional namespace aliases | ||
| 172 | // - fully qualified - | ||
| 173 | void func9() | ||
| 174 | { | ||
| 175 | alias_for_somestuff::OneClass c; | ||
| 176 | c.//-11- | ||
| 177 | ; //#11# ( "aFunc" "anInt" ) | ||
| 178 | alias_for_outerinner::AnotherStruct s; | ||
| 179 | s. //-12- | ||
| 180 | ; //#12# ( "four" "three" ) | ||
| 181 | } | ||
| 182 | |||
| 183 | // - unqualified - | ||
| 184 | void func10() | ||
| 185 | { | ||
| 186 | using namespace alias_for_somestuff; | ||
| 187 | OneClass c2; | ||
| 188 | c2.//-13- | ||
| 189 | ; //#13# ( "aFunc" "anInt" ) | ||
| 190 | using namespace alias_for_outerinner; | ||
| 191 | AnotherStruct s2; | ||
| 192 | s2.//-14- | ||
| 193 | ; //#14# ( "four" "three" ) | ||
| 194 | } | ||
| 195 | |||
| 196 | // Completion on namespace aliases | ||
| 197 | void func11() | ||
| 198 | { | ||
| 199 | alias_for_somestuff:://-15- | ||
| 200 | ; //#15# ( "OneClass" "aStruct") | ||
| 201 | alias_for_outerinner:://-16- | ||
| 202 | ; //#16# ( "AnotherStruct" "StructNested" ) | ||
| 203 | } | ||
| 204 | |||
| 205 | // make sure unfound using statements don't crash stuff. | ||
| 206 | using something::cantbe::Found; | ||
| 207 | |||
| 208 | void unfoundfunc() | ||
| 209 | { | ||
| 210 | NotFound notfound; // Variable can't be found. | ||
| 211 | |||
| 212 | notfound.//-17- | ||
| 213 | ; //#17# ( ) Nothing here since this is an undefined class | ||
| 214 | |||
| 215 | } | ||
| 216 | |||
| 217 | // Using statements can depend on previous ones... | ||
| 218 | |||
| 219 | void acc_using() | ||
| 220 | { | ||
| 221 | using namespace outer; | ||
| 222 | // This is effectively like 'using namespace outer::inner' | ||
| 223 | using namespace inner; | ||
| 224 | |||
| 225 | StructNested sn; | ||
| 226 | sn.//-18- | ||
| 227 | ; //#18# ( "one" "two" ) | ||
| 228 | } | ||
| 229 | |||
| 230 | // Check the same outside of function scope | ||
| 231 | |||
| 232 | using namespace outer; | ||
| 233 | using namespace inner; | ||
| 234 | |||
| 235 | void acc_using2() | ||
| 236 | { | ||
| 237 | StructNested sn; | ||
| 238 | sn.//-19- | ||
| 239 | ; //#19# ( "one" "two" ) | ||
| 240 | } | ||
| 241 | |||
| 242 | // Check if scope gets correctly generated, i.e., without us providing any | ||
| 243 | // hints in the form of an existing type | ||
| 244 | |||
| 245 | void check_scope() | ||
| 246 | { | ||
| 247 | using namespace first; | ||
| 248 | AAA//-20- | ||
| 249 | ; //#20# ( "AAA1" "AAA2" ) | ||
| 250 | } | ||
| 251 | |||
| 252 | void check_scope2() | ||
| 253 | { | ||
| 254 | using namespace third; | ||
| 255 | AAA//-21- | ||
| 256 | ; //#21# ( "AAA1" "AAA2" "AAA3" ) | ||
| 257 | } | ||
| 258 | |||
| 259 | // Make sure this also works not only in functions | ||
| 260 | |||
| 261 | namespace check_scope3 { | ||
| 262 | using namespace first; | ||
| 263 | AAA//-22- | ||
| 264 | ; //#22# ( "AAA1" "AAA2" ) | ||
| 265 | } | ||
diff --git a/test/manual/cedet/tests/testusing.hh b/test/manual/cedet/tests/testusing.hh new file mode 100644 index 00000000000..18a33dac46e --- /dev/null +++ b/test/manual/cedet/tests/testusing.hh | |||
| @@ -0,0 +1,176 @@ | |||
| 1 | // testusing.hh --- 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 | namespace moose { | ||
| 23 | |||
| 24 | class Point; | ||
| 25 | |||
| 26 | class MyClass; | ||
| 27 | |||
| 28 | } | ||
| 29 | |||
| 30 | |||
| 31 | namespace moose { | ||
| 32 | |||
| 33 | class Point; | ||
| 34 | |||
| 35 | class MyClass { | ||
| 36 | public: | ||
| 37 | MyClass() : fVal(0) { | ||
| 38 | } | ||
| 39 | |||
| 40 | ~MyClass() {}; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * fVal Accessors | ||
| 44 | * @{ | ||
| 45 | */ | ||
| 46 | int getVal() const { | ||
| 47 | return fVal; | ||
| 48 | } | ||
| 49 | void setVal(int Val) const { | ||
| 50 | fVal = Val; | ||
| 51 | } | ||
| 52 | /** | ||
| 53 | * @} | ||
| 54 | */ | ||
| 55 | |||
| 56 | private: | ||
| 57 | int fVal; | ||
| 58 | }; | ||
| 59 | |||
| 60 | } | ||
| 61 | |||
| 62 | namespace togglemoose { | ||
| 63 | |||
| 64 | class MyOtherClass { | ||
| 65 | public: | ||
| 66 | int testToggle1(); | ||
| 67 | int testToggle2(); | ||
| 68 | int testToggle3(); | ||
| 69 | }; | ||
| 70 | } | ||
| 71 | |||
| 72 | namespace deer { | ||
| 73 | |||
| 74 | class Pickle; | ||
| 75 | |||
| 76 | }; | ||
| 77 | |||
| 78 | // Code from Zhiqiu Kong | ||
| 79 | |||
| 80 | #ifndef BREAD_H | ||
| 81 | #define BREAD_H | ||
| 82 | |||
| 83 | namespace bread_name { | ||
| 84 | class bread | ||
| 85 | { | ||
| 86 | public: | ||
| 87 | void geta(); | ||
| 88 | private: | ||
| 89 | int m_a; | ||
| 90 | int m_b; | ||
| 91 | }; | ||
| 92 | } | ||
| 93 | |||
| 94 | #endif | ||
| 95 | |||
| 96 | // Code from David Engster | ||
| 97 | // Creating alias types through 'using' trickery | ||
| 98 | |||
| 99 | namespace somestuff { | ||
| 100 | class OneClass { | ||
| 101 | public: | ||
| 102 | void aFunc(); | ||
| 103 | int anInt; | ||
| 104 | }; | ||
| 105 | struct aStruct { | ||
| 106 | int foo; | ||
| 107 | int bar; | ||
| 108 | }; | ||
| 109 | } | ||
| 110 | |||
| 111 | namespace otherstuff { | ||
| 112 | // make otherstuff::OneClass an alias for somestuff::OneClass | ||
| 113 | using somestuff::OneClass; | ||
| 114 | } | ||
| 115 | |||
| 116 | namespace morestuff { | ||
| 117 | // make morestuff an alias namespace for somestuff | ||
| 118 | using namespace somestuff; | ||
| 119 | // but hide aStruct with own type | ||
| 120 | struct aStruct { | ||
| 121 | int anotherFoo; | ||
| 122 | int anotherBar; | ||
| 123 | }; | ||
| 124 | } | ||
| 125 | |||
| 126 | // We can also create an alias for an alias | ||
| 127 | namespace evenmorestuff { | ||
| 128 | using otherstuff::OneClass; | ||
| 129 | } | ||
| 130 | |||
| 131 | // Now with nested namespaces | ||
| 132 | namespace outer { | ||
| 133 | namespace inner { | ||
| 134 | struct StructNested { | ||
| 135 | int one; | ||
| 136 | int two; | ||
| 137 | }; | ||
| 138 | struct AnotherStruct { | ||
| 139 | int three; | ||
| 140 | int four; | ||
| 141 | }; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | |||
| 145 | // Namespace which pulls in one of its own nested namespaces | ||
| 146 | namespace first { | ||
| 147 | class AAA1; | ||
| 148 | namespace second { | ||
| 149 | class AAA2; | ||
| 150 | } | ||
| 151 | // Elevate nested namespace into first one | ||
| 152 | using namespace second; | ||
| 153 | } | ||
| 154 | |||
| 155 | namespace third { | ||
| 156 | using namespace first; | ||
| 157 | class AAA3; | ||
| 158 | } | ||
| 159 | |||
| 160 | |||
| 161 | // Elevate the first struct into 'outer' | ||
| 162 | // so that we can access it via 'outer::StructNested' | ||
| 163 | namespace outer { | ||
| 164 | using outer::inner::StructNested; | ||
| 165 | } | ||
| 166 | |||
| 167 | // Create an alias for a nested namespace | ||
| 168 | namespace outerinner { | ||
| 169 | // equivalent to 'namespace outerinner = outer::inner;' | ||
| 170 | using namespace outer::inner; | ||
| 171 | } | ||
| 172 | |||
| 173 | // Create namespace alias | ||
| 174 | namespace alias_for_somestuff = somestuff; | ||
| 175 | // Same for nested namespace | ||
| 176 | namespace alias_for_outerinner = outer::inner; | ||
diff --git a/test/manual/cedet/tests/testvarnames.java b/test/manual/cedet/tests/testvarnames.java new file mode 100644 index 00000000000..217a10d53e2 --- /dev/null +++ b/test/manual/cedet/tests/testvarnames.java | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | // testvarnames.java --- Semantic unit test for Java | ||
| 2 | |||
| 3 | // Copyright (C) 2009-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 | package tests; | ||
| 23 | |||
| 24 | /** | ||
| 25 | * | ||
| 26 | * | ||
| 27 | * Created: 02/17/14 | ||
| 28 | * | ||
| 29 | * @author Eric M. Ludlam | ||
| 30 | * @version | ||
| 31 | * @since | ||
| 32 | */ | ||
| 33 | public class testvarnames { | ||
| 34 | |||
| 35 | public class varorclass { | ||
| 36 | public static long misclongvalue; | ||
| 37 | }; | ||
| 38 | |||
| 39 | public static varorclass varoftypevarorclass = NULL; | ||
| 40 | |||
| 41 | public static long varorclass = 1; | ||
| 42 | |||
| 43 | public static long assignintovar = 1; | ||
| 44 | |||
| 45 | public static varorclass classassign = NULL; | ||
| 46 | |||
| 47 | static public void main(String [] args) { | ||
| 48 | |||
| 49 | varorclass = assign// -1- | ||
| 50 | // #1# ( "assignintovar" ) | ||
| 51 | ; | ||
| 52 | |||
| 53 | varoftypevarorclass = clas// -2- | ||
| 54 | // #2# ( "classassign" ) | ||
| 55 | |||
| 56 | varoftypevarorclass.misc//-3- | ||
| 57 | // #3# ( "misclongvalue" ) | ||
| 58 | } | ||
| 59 | |||
| 60 | } // testvarnames | ||
diff --git a/test/manual/cedet/tests/testwisent.wy b/test/manual/cedet/tests/testwisent.wy new file mode 100644 index 00000000000..07f8637a655 --- /dev/null +++ b/test/manual/cedet/tests/testwisent.wy | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | ;; testwisent.wy --- unit test support file for semantic-utest-ia | ||
| 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 | ;;; Commentary: | ||
| 23 | ;; | ||
| 24 | ;; Parser for nothing in particular mode | ||
| 25 | |||
| 26 | %languagemode nothing-mode | ||
| 27 | %parsetable wisent-nothing-parser-tables | ||
| 28 | %keywordtable wisent-nothing-keywords | ||
| 29 | %tokentable wisent-nothing-tokens | ||
| 30 | %languagemode nothing-mode | ||
| 31 | %setupfunction wisent-nothing-default-setup | ||
| 32 | |||
| 33 | %start goal | ||
| 34 | |||
| 35 | ;;; Punctuation | ||
| 36 | %type <punctuation> ;;syntax "\\(\\s.\\|\\s$\\|\\s'\\)+" matchdatatype string | ||
| 37 | |||
| 38 | %token <punctuation> DOT "." | ||
| 39 | %token <punctuation> COMA "," | ||
| 40 | %token <punctuation> COLONCOLON "::" | ||
| 41 | %token <punctuation> COLON ":" | ||
| 42 | %token <punctuation> SEMICOLON ";" | ||
| 43 | |||
| 44 | ;;; KEYWORDS | ||
| 45 | %type <keyword> | ||
| 46 | |||
| 47 | %keyword COLONOSCOPY "colonoscopy" | ||
| 48 | %keyword SEMISOMETHING "semisomething" | ||
| 49 | |||
| 50 | %% | ||
| 51 | |||
| 52 | goal | ||
| 53 | ;; Misc | ||
| 54 | : COLON ;; -1- | ||
| 55 | ;; #1# ( "COLONCOLON" "COLON" "COLONOSCOPY" ) | ||
| 56 | | SEMI ;; -2- | ||
| 57 | ;; #2# ( "SEMI_useless_rule" "SEMICOLON" "SEMISOMETHING" ) | ||
| 58 | | thing ;; -3- | ||
| 59 | ;; #3# ( "thing_term_1" "thing_term_2" ) | ||
| 60 | ; | ||
| 61 | |||
| 62 | SEMI_useless_rule | ||
| 63 | : | ||
| 64 | ; | ||
| 65 | |||
| 66 | thing_term_1 | ||
| 67 | : | ||
| 68 | ; | ||
| 69 | |||
| 70 | thing_term_2 | ||
| 71 | : | ||
| 72 | ; | ||
| 73 | |||
| 74 | %% | ||
| 75 | (define-lex wisent-nothing-lexer | ||
| 76 | "Lexical analyzer to handle nothing in particular buffers." | ||
| 77 | ;; semantic-lex-newline | ||
| 78 | semantic-lex-ignore-whitespace | ||
| 79 | semantic-lex-ignore-newline | ||
| 80 | semantic-lex-ignore-comments | ||
| 81 | |||
| 82 | semantic-lex-default-action | ||
| 83 | ) | ||
| 84 | |||
| 85 | ;; testwisent.wy ends here \ No newline at end of file | ||