xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.tui/completion.exp (revision 901e7e84758515fbf39dfc064cb0b45ab146d8b0)
1# Copyright 2015-2020 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
16gdb_exit
17gdb_start
18
19if {[skip_tui_tests] || [target_info exists gdb,nointerrupts]} {
20    return
21}
22
23gdb_test_no_output "set max-completions unlimited"
24
25# TAB-complete INPUT_LINE, and expect EXPECTED_RE as completion match
26# output.
27proc test_tab_completion {input_line expected_re} {
28    global gdb_prompt
29
30    set test "tab completion"
31    send_gdb "$input_line\t\t\t"
32    gdb_test_multiple "" "$test" {
33	-re "$expected_re\r\n$gdb_prompt " {
34	    gdb_test_multiple "" "$test" {
35		-re "^$input_line $" {
36		    pass "$test"
37		}
38	    }
39	}
40    }
41    send_gdb "\003"
42    set test "quit command input"
43    gdb_test_multiple "" "$test" {
44	-re "$gdb_prompt $" {
45	    pass "$test"
46	}
47    }
48}
49
50with_test_prefix "completion of layout names" {
51    test_tab_completion "layout" "asm *next *prev *regs *split *src *"
52}
53
54with_test_prefix "completion of focus command" {
55    test_tab_completion "focus" "cmd *next *prev *src *"
56}
57