Commit | Line | Data |
---|---|---|
a4100ebe CY |
1 | // testdoublens.cpp --- semantic-ia-utest completion engine unit tests |
2 | ||
acaf905b | 3 | // Copyright (C) 2008-2012 Free Software Foundation, Inc. |
a4100ebe CY |
4 | |
5 | // Author: Eric M. Ludlam <eric@siege-engine.com> | |
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 <http://www.gnu.org/licenses/>. | |
21 | ||
74ea13c1 CY |
22 | #include "testdoublens.hpp" |
23 | ||
24 | namespace Name1 { | |
25 | namespace Name2 { | |
26 | ||
27 | Foo::Foo() | |
28 | { | |
29 | p// -1- | |
30 | // #1# ( "pMumble" "publishStuff" ) | |
31 | ; | |
32 | } | |
33 | ||
34 | int Foo::get() // ^1^ | |
35 | { | |
36 | p// -2- | |
37 | // #2# ( "pMumble" "publishStuff" ) | |
38 | ; | |
39 | return 0; | |
40 | } | |
41 | ||
42 | void Foo::publishStuff(int /* a */, int /* b */) // ^2^ | |
43 | { | |
44 | } | |
45 | ||
46 | void Foo::sendStuff(int /* a */, int /* b */) // ^3^ | |
47 | { | |
48 | } | |
a4100ebe | 49 | |
74ea13c1 CY |
50 | } // namespace Name2 |
51 | } // namespace Name1 | |
52 | ||
53 | // Test multiple levels of metatype expansion | |
54 | int test_fcn () { | |
55 | stage3_Foo MyFoo; | |
56 | ||
57 | MyFoo.// -3- | |
58 | // #3# ( "Mumble" "get" ) | |
59 | ; | |
60 | ||
61 | Name1::Name2::F//-4- | |
62 | // #4# ( "Foo" ) | |
63 | ; | |
a4100ebe | 64 | |
74ea13c1 CY |
65 | // @TODO - get this working... |
66 | Name1::stage2_Foo::M//-5- | |
67 | /// #5# ( "Mumble" ) | |
68 | ; | |
69 | } | |
70 | ||
71 | stage3_Foo foo_fcn() { | |
72 | // Can we go "up" to foo with senator-go-to-up-reference? | |
73 | } | |
74 | ||
75 | ||
76 | // Second test from Ravikiran Rajagopal | |
77 | ||
a4100ebe | 78 | namespace A { |
74ea13c1 CY |
79 | class foo { |
80 | public: | |
81 | void aa(); | |
82 | void bb(); | |
83 | }; | |
84 | } | |
a4100ebe CY |
85 | namespace A { |
86 | class bar { | |
74ea13c1 CY |
87 | public: |
88 | void xx(); | |
89 | public: | |
90 | foo myFoo; | |
91 | }; | |
92 | ||
93 | void bar::xx() | |
94 | { | |
95 | myFoo.// -6- <--- cursor is here after the dot | |
96 | // #6# ( "aa" "bb" ) | |
97 | ; | |
98 | } | |
99 | } | |
100 | ||
101 | // Double namespace example from Hannu Koivisto | |
102 | // | |
103 | // This is tricky because the parent class "Foo" is found within the | |
104 | // scope of B, so the scope calculation needs to put that together | |
105 | // before searching for parents in scope. | |
106 | namespace a { | |
107 | namespace b { | |
108 | ||
109 | class Bar : public Foo | |
110 | { | |
111 | int baz(); | |
112 | }; | |
113 | ||
114 | int Bar::baz() | |
115 | { | |
a4100ebe | 116 | return dum// -7- |
74ea13c1 CY |
117 | // #7# ( "dumdum" ) |
118 | ; | |
119 | } | |
120 | ||
121 | } // namespace b | |
122 | } // namespace a | |
123 | ||
124 | // Three namespace example from Hannu Koivisto | |
125 | // | |
126 | // This one is special in that the name e::Foo, where "e" is in | |
127 | // the scope, and not referenced from the global namespace. This | |
128 | // wasn't previously handled, so the fullscope needed to be added | |
129 | // to the list of things searched when in split-name decent search mode | |
130 | // for scopes. | |
131 | ||
132 | namespace d { | |
133 | namespace e { | |
134 | ||
135 | class Foo | |
136 | { | |
137 | public: | |
138 | int write(); | |
139 | }; | |
140 | ||
141 | } // namespace d | |
142 | } // namespace e | |
143 | ||
144 | ||
145 | namespace d { | |
146 | namespace f { | |
147 | ||
148 | class Bar | |
149 | { | |
150 | public: | |
151 | int baz(); | |
152 | ||
153 | private: | |
154 | e::Foo &foo; | |
155 | }; | |
156 | ||
157 | int Bar::baz() | |
158 | { | |
159 | return foo.w// -8- | |
160 | // #8# ( "write" ) | |
161 | ; | |
162 | } | |
163 | ||
164 | } // namespace f | |
165 | } // namespace d | |
3999968a | 166 |