blob: 0e283e8b23fbfc02f4626be403418343b1ac0ea9 [file] [log] [blame]
# Copyright (C) 2014-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set testfile "py-completion"
load_lib gdb-python.exp
gdb_exit
gdb_start
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
gdb_test_no_output "source ${srcdir}/${subdir}/${testfile}.py"
# Create a temporary directory
set testdir "[standard_output_file "py-completion-testdir"]/"
set testdir_regex [string_to_regexp $testdir]
set testdir_complete [standard_output_file "py-completion-test"]
file mkdir $testdir
# This one should always pass.
send_gdb "completefileinit ${testdir_complete}\t"
gdb_test_multiple "" "completefileinit completion" {
-re "^completefileinit ${testdir_regex}$" {
pass "completefileinit completion"
}
}
# Just discarding whatever we typed.
gdb_test " " ".*" "discard #1"
# This is the problematic one.
send_gdb "completefilemethod ${testdir_complete}\t"
gdb_test_multiple "" "completefilemethod completion" {
-re "^completefilemethod ${testdir_regex} $" {
fail "completefilemethod completion (completed filename as wrong command arg)"
}
-re "^completefilemethod ${testdir_regex}$" {
pass "completefilemethod completion"
}
}
# Discarding again
gdb_test " " ".*" "discard #2"
# Another problematic
set completion_regex "[string_to_regexp [standard_output_file "py-completion-t"]]"
send_gdb "completefilecommandcond [standard_output_file "py-completion-t\t"]"
gdb_test_multiple "" "completefilecommandcond completion" {
-re "^completefilecommandcond ${testdir}$" {
fail "completefilecommandcond completion (completed filename instead of command)"
}
-re "^completefilecommandcond ${completion_regex}\007$" {
pass "completefilecommandcond completion"
}
}