Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright (C) 2014-2022 Free Software Foundation, Inc. |
7d793aa9 SDJ |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | # This testcase tests PR python/16699 | |
17 | ||
18 | import gdb | |
19 | ||
13123da8 | 20 | |
7d793aa9 | 21 | class CompleteFileInit(gdb.Command): |
13123da8 SM |
22 | def __init__(self): |
23 | gdb.Command.__init__( | |
24 | self, "completefileinit", gdb.COMMAND_USER, gdb.COMPLETE_FILENAME | |
25 | ) | |
26 | ||
27 | def invoke(self, argument, from_tty): | |
28 | raise gdb.GdbError("not implemented") | |
7d793aa9 | 29 | |
7d793aa9 SDJ |
30 | |
31 | class CompleteFileMethod(gdb.Command): | |
13123da8 SM |
32 | def __init__(self): |
33 | gdb.Command.__init__(self, "completefilemethod", gdb.COMMAND_USER) | |
7d793aa9 | 34 | |
13123da8 SM |
35 | def invoke(self, argument, from_tty): |
36 | raise gdb.GdbError("not implemented") | |
37 | ||
38 | def complete(self, text, word): | |
39 | return gdb.COMPLETE_FILENAME | |
7d793aa9 | 40 | |
7d793aa9 SDJ |
41 | |
42 | class CompleteFileCommandCond(gdb.Command): | |
13123da8 SM |
43 | def __init__(self): |
44 | gdb.Command.__init__(self, "completefilecommandcond", gdb.COMMAND_USER) | |
45 | ||
46 | def invoke(self, argument, from_tty): | |
47 | raise gdb.GdbError("not implemented") | |
48 | ||
49 | def complete(self, text, word): | |
50 | # This is a test made to know if the command | |
51 | # completion still works fine. When the user asks to | |
52 | # complete something like "completefilecommandcond | |
53 | # /path/to/py-completion-t", it should not complete to | |
54 | # "/path/to/py-completion-test/", but instead just | |
55 | # wait for input. | |
56 | if "py-completion-t" in text: | |
57 | return gdb.COMPLETE_COMMAND | |
58 | else: | |
59 | return gdb.COMPLETE_FILENAME | |
60 | ||
7d793aa9 | 61 | |
6d62641c | 62 | class CompleteLimit1(gdb.Command): |
13123da8 SM |
63 | def __init__(self): |
64 | gdb.Command.__init__(self, "completelimit1", gdb.COMMAND_USER) | |
6d62641c | 65 | |
13123da8 SM |
66 | def invoke(self, argument, from_tty): |
67 | raise gdb.GdbError("not implemented") | |
6d62641c | 68 | |
13123da8 SM |
69 | def complete(self, text, word): |
70 | return ["cl11", "cl12", "cl13"] | |
6d62641c | 71 | |
6d62641c | 72 | |
13123da8 SM |
73 | class CompleteLimit2(gdb.Command): |
74 | def __init__(self): | |
75 | gdb.Command.__init__(self, "completelimit2", gdb.COMMAND_USER) | |
76 | ||
77 | def invoke(self, argument, from_tty): | |
78 | raise gdb.GdbError("not implemented") | |
79 | ||
80 | def complete(self, text, word): | |
81 | return [ | |
82 | "cl21", | |
83 | "cl23", | |
84 | "cl25", | |
85 | "cl27", | |
86 | "cl29", | |
87 | "cl22", | |
88 | "cl24", | |
89 | "cl26", | |
90 | "cl28", | |
91 | "cl210", | |
92 | ] | |
6d62641c | 93 | |
6d62641c SDJ |
94 | |
95 | class CompleteLimit3(gdb.Command): | |
13123da8 SM |
96 | def __init__(self): |
97 | gdb.Command.__init__(self, "completelimit3", gdb.COMMAND_USER) | |
98 | ||
99 | def invoke(self, argument, from_tty): | |
100 | raise gdb.GdbError("not implemented") | |
101 | ||
102 | def complete(self, text, word): | |
103 | return [ | |
104 | "cl31", | |
105 | "cl33", | |
106 | "cl35", | |
107 | "cl37", | |
108 | "cl39", | |
109 | "cl32", | |
110 | "cl34", | |
111 | "cl36", | |
112 | "cl38", | |
113 | "cl310", | |
114 | ] | |
6d62641c | 115 | |
6d62641c SDJ |
116 | |
117 | class CompleteLimit4(gdb.Command): | |
13123da8 SM |
118 | def __init__(self): |
119 | gdb.Command.__init__(self, "completelimit4", gdb.COMMAND_USER) | |
120 | ||
121 | def invoke(self, argument, from_tty): | |
122 | raise gdb.GdbError("not implemented") | |
123 | ||
124 | def complete(self, text, word): | |
125 | return [ | |
126 | "cl41", | |
127 | "cl43", | |
128 | "cl45", | |
129 | "cl47", | |
130 | "cl49", | |
131 | "cl42", | |
132 | "cl44", | |
133 | "cl46", | |
134 | "cl48", | |
135 | "cl410", | |
136 | ] | |
6d62641c | 137 | |
6d62641c SDJ |
138 | |
139 | class CompleteLimit5(gdb.Command): | |
13123da8 SM |
140 | def __init__(self): |
141 | gdb.Command.__init__(self, "completelimit5", gdb.COMMAND_USER) | |
142 | ||
143 | def invoke(self, argument, from_tty): | |
144 | raise gdb.GdbError("not implemented") | |
145 | ||
146 | def complete(self, text, word): | |
147 | return [ | |
148 | "cl51", | |
149 | "cl53", | |
150 | "cl55", | |
151 | "cl57", | |
152 | "cl59", | |
153 | "cl52", | |
154 | "cl54", | |
155 | "cl56", | |
156 | "cl58", | |
157 | "cl510", | |
158 | ] | |
6d62641c | 159 | |
6d62641c SDJ |
160 | |
161 | class CompleteLimit6(gdb.Command): | |
13123da8 SM |
162 | def __init__(self): |
163 | gdb.Command.__init__(self, "completelimit6", gdb.COMMAND_USER) | |
164 | ||
165 | def invoke(self, argument, from_tty): | |
166 | raise gdb.GdbError("not implemented") | |
167 | ||
168 | def complete(self, text, word): | |
169 | return [ | |
170 | "cl61", | |
171 | "cl63", | |
172 | "cl65", | |
173 | "cl67", | |
174 | "cl69", | |
175 | "cl62", | |
176 | "cl64", | |
177 | "cl66", | |
178 | "cl68", | |
179 | "cl610", | |
180 | ] | |
6d62641c | 181 | |
6d62641c SDJ |
182 | |
183 | class CompleteLimit7(gdb.Command): | |
13123da8 SM |
184 | def __init__(self): |
185 | gdb.Command.__init__(self, "completelimit7", gdb.COMMAND_USER) | |
186 | ||
187 | def invoke(self, argument, from_tty): | |
188 | raise gdb.GdbError("not implemented") | |
189 | ||
190 | def complete(self, text, word): | |
191 | return [ | |
192 | "cl71", | |
193 | "cl73", | |
194 | "cl75", | |
195 | "cl77", | |
196 | "cl79", | |
197 | "cl72", | |
198 | "cl74", | |
199 | "cl76", | |
200 | "cl78", | |
201 | "cl710", | |
202 | ] | |
6d62641c | 203 | |
6d62641c | 204 | |
7d793aa9 SDJ |
205 | CompleteFileInit() |
206 | CompleteFileMethod() | |
207 | CompleteFileCommandCond() | |
6d62641c SDJ |
208 | CompleteLimit1() |
209 | CompleteLimit2() | |
210 | CompleteLimit3() | |
211 | CompleteLimit4() | |
212 | CompleteLimit5() | |
213 | CompleteLimit6() | |
214 | CompleteLimit7() |