Fix PR gdb/17035: "show user" doesn't list user-defined commands that
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-completion.exp
CommitLineData
7d793aa9
SDJ
1# Copyright (C) 2014 Free Software Foundation, Inc.
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
16set testfile "py-completion"
17
18load_lib gdb-python.exp
19
20gdb_exit
21gdb_start
22
23# Skip all tests if Python scripting is not enabled.
24if { [skip_python_tests] } { continue }
25
26gdb_test_no_output "source ${srcdir}/${subdir}/${testfile}.py"
27
28# Create a temporary directory
29set testdir "[standard_output_file "py-completion-testdir"]/"
30set testdir_regex [string_to_regexp $testdir]
31set testdir_complete [standard_output_file "py-completion-test"]
32file mkdir $testdir
33
34# This one should always pass.
35send_gdb "completefileinit ${testdir_complete}\t"
36gdb_test_multiple "" "completefileinit completion" {
37 -re "^completefileinit ${testdir_regex}$" {
38 pass "completefileinit completion"
39 }
40}
41
42# Just discarding whatever we typed.
43gdb_test " " ".*" "discard #1"
44
45# This is the problematic one.
46send_gdb "completefilemethod ${testdir_complete}\t"
47gdb_test_multiple "" "completefilemethod completion" {
48 -re "^completefilemethod ${testdir_regex} $" {
49 fail "completefilemethod completion (completed filename as wrong command arg)"
50 }
51 -re "^completefilemethod ${testdir_regex}$" {
52 pass "completefilemethod completion"
53 }
54}
55
56# Discarding again
57gdb_test " " ".*" "discard #2"
58
59# Another problematic
60set completion_regex "[string_to_regexp [standard_output_file "py-completion-t"]]"
61send_gdb "completefilecommandcond [standard_output_file "py-completion-t\t"]"
62gdb_test_multiple "" "completefilecommandcond completion" {
63 -re "^completefilecommandcond ${testdir}$" {
64 fail "completefilecommandcond completion (completed filename instead of command)"
65 }
66 -re "^completefilecommandcond ${completion_regex}\007$" {
67 pass "completefilecommandcond completion"
68 }
69}
This page took 0.025119 seconds and 4 git commands to generate.