1 # Copyright (C) 2014-2015 Free Software Foundation, Inc.
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.
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.
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/>.
16 set testfile "py-completion"
18 load_lib gdb-python.exp
23 # Skip all tests if Python scripting is not enabled.
24 if { [skip_python_tests] } { continue }
26 gdb_test_no_output "source ${srcdir}/${subdir}/${testfile}.py"
28 # Create a temporary directory
29 set testdir "[standard_output_file "py-completion-testdir"]/"
30 set testdir_regex [string_to_regexp $testdir]
31 set testdir_complete [standard_output_file "py-completion-test"]
34 # This one should always pass.
35 send_gdb "completefileinit ${testdir_complete}\t"
36 gdb_test_multiple "" "completefileinit completion" {
37 -re "^completefileinit ${testdir_regex}$" {
38 pass "completefileinit completion"
42 # Just discarding whatever we typed.
43 gdb_test " " ".*" "discard #1"
45 # This is the problematic one.
46 send_gdb "completefilemethod ${testdir_complete}\t"
47 gdb_test_multiple "" "completefilemethod completion" {
48 -re "^completefilemethod ${testdir_regex} $" {
49 fail "completefilemethod completion (completed filename as wrong command arg)"
51 -re "^completefilemethod ${testdir_regex}$" {
52 pass "completefilemethod completion"
57 gdb_test " " ".*" "discard #2"
60 set completion_regex "[string_to_regexp [standard_output_file "py-completion-t"]]"
61 send_gdb "completefilecommandcond [standard_output_file "py-completion-t\t"]"
62 gdb_test_multiple "" "completefilecommandcond completion" {
63 -re "^completefilecommandcond ${testdir}$" {
64 fail "completefilecommandcond completion (completed filename instead of command)"
66 -re "^completefilecommandcond ${completion_regex}\007$" {
67 pass "completefilecommandcond completion"