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