]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/readline-ask.exp
Simplify ada_lookup_encoded_symbol
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / readline-ask.exp
CommitLineData
1d506c26 1# Copyright (C) 2011-2024 Free Software Foundation, Inc.
7ff911a3
JK
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
822bd149 16standard_testfile .c
7ff911a3
JK
17set inputrc ${srcdir}/${subdir}/${testfile}.inputrc
18
19if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}] != "" } {
5b362f04 20 untested "failed to compile"
7ff911a3
JK
21 return -1
22}
23
4ebfd53d
TT
24setenv TERM dumb
25
7ff911a3
JK
26# INPUTRC gets reset for the next testfile.
27setenv INPUTRC $inputrc
822bd149 28clean_restart ${binfile}
7ff911a3 29
0d4d0e77
YQ
30if { ![readline_is_used] } {
31 unsupported "completion doesn't work when readline isn't used."
32 return -1
33}
34
7ff911a3
JK
35gdb_test_no_output "set width 50"
36gdb_test_no_output "set height 3"
37
38set cmd "p symbol_0"
39send_gdb "$cmd\t"
40set test "bell for more message"
41gdb_test_multiple "" $test {
42 -re "$cmd\007$" {
43 pass $test
44 }
45}
46
47send_gdb "\t"
48set test "more message for 01 and 02"
49gdb_test_multiple "" $test {
50 -re "^\r\nsymbol_01_length_40_____________________\r\nsymbol_02_length_40_____________________\r\n--More--$" {
51 pass $test
52 }
53 -re "$gdb_prompt " {
54 fail $test
55 }
56}
57
58# There get some VT100 characters printed.
59
60send_gdb "\r"
61set test "more message for 03"
62gdb_test_multiple "" $test {
63 -re "\rsymbol_03_length_40_____________________\r\n--More--$" {
64 pass $test
65 }
66}
67
68# "$gdb_prompt $" will not match as $cmd gets output: $gdb_prompt p symbol_0
69# And "$gdb_prompt p symbol_0" cannot be matched as the default "$gdb_prompt $"
70# string from gdb_test_multiple could match earlier.
71
72send_gdb "\r"
73set test "more finish for 04"
74gdb_test_multiple "" $test {
75 -re "\rsymbol_04_length_40_____________________\r\n$gdb_prompt " {
76 pass $test
77 }
78}
79
80gdb_test "foo" {No symbol "symbol_0foo" in current context\.} "abort more message"
81
82set cmd "p symbol_"
83send_gdb "$cmd\t"
84set test "bell for ask message"
85gdb_test_multiple "" $test {
86 -re "$cmd\007$" {
87 pass $test
88 }
89}
90
91send_gdb "\t"
92set test "ask message"
93gdb_test_multiple "" $test {
94 -re "^\r\nDisplay all 5 possibilities\\? \\(y or n\\)$" {
95 pass $test
96 }
97 -re "$gdb_prompt " {
98 fail $test
99 return 0
100 }
101}
102
103send_gdb "y"
104set test "ask message for 01 and 02"
105gdb_test_multiple "" $test {
106 -re "^\r\nsymbol_01_length_40_____________________\r\nsymbol_02_length_40_____________________\r\n--More--$" {
107 pass $test
108 }
109}
110
111# There get some VT100 characters printed.
112# See the "$gdb_prompt " match like in "more finish for 04".
113
114send_gdb "n"
115set test "ask message no"
116gdb_test_multiple "" $test {
117 -re "\r$gdb_prompt " {
118 pass $test
119 }
120}
121
122gdb_test "foo" {No symbol "symbol_foo" in current context\.} "abort ask message"