Commit | Line | Data |
---|---|---|
32d0add0 | 1 | # Copyright (C) 2014-2015 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 | ||
20 | class CompleteFileInit(gdb.Command): | |
21 | def __init__(self): | |
22 | gdb.Command.__init__(self,'completefileinit',gdb.COMMAND_USER,gdb.COMPLETE_FILENAME) | |
23 | ||
24 | def invoke(self,argument,from_tty): | |
25 | raise gdb.GdbError('not implemented') | |
26 | ||
27 | class CompleteFileMethod(gdb.Command): | |
28 | def __init__(self): | |
29 | gdb.Command.__init__(self,'completefilemethod',gdb.COMMAND_USER) | |
30 | ||
31 | def invoke(self,argument,from_tty): | |
32 | raise gdb.GdbError('not implemented') | |
33 | ||
34 | def complete(self,text,word): | |
35 | return gdb.COMPLETE_FILENAME | |
36 | ||
37 | class CompleteFileCommandCond(gdb.Command): | |
38 | def __init__(self): | |
39 | gdb.Command.__init__(self,'completefilecommandcond',gdb.COMMAND_USER) | |
40 | ||
41 | def invoke(self,argument,from_tty): | |
42 | raise gdb.GdbError('not implemented') | |
43 | ||
44 | def complete(self,text,word): | |
45 | # This is a test made to know if the command | |
46 | # completion still works fine. When the user asks to | |
47 | # complete something like "completefilecommandcond | |
48 | # /path/to/py-completion-t", it should not complete to | |
49 | # "/path/to/py-completion-test/", but instead just | |
50 | # wait for input. | |
51 | if "py-completion-t" in text: | |
52 | return gdb.COMPLETE_COMMAND | |
53 | else: | |
54 | return gdb.COMPLETE_FILENAME | |
55 | ||
56 | CompleteFileInit() | |
57 | CompleteFileMethod() | |
58 | CompleteFileCommandCond() |