1 # Copyright
2023-2024 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 # Test a prompt one less than
, equal to
, and one more than screen width in
19 require allow_tui_tests
23 with_test_prefix
"prompt size == width + 1" {
24 Term
::clean_restart
24 40
26 if {![Term
::enter_tui
]} {
27 unsupported
"TUI not supported"
31 set prompt
"123456789A123456789B123456789C123456789D>"
33 #
Set new prompt
, and
set old prompt
back.
34 send_gdb
"set prompt $prompt\n"
35 send_gdb
"set prompt (gdb) \n"
39 #
16 (gdb
) set prompt
123456789A123456789B123
40 #
17 456789C123456789D
>
41 #
18 123456789A123456789B123456789C123456789D
42 #
19 >set prompt
(gdb
)
45 gdb_assert
{ [Term
::wait_for
"^>set prompt $gdb_prompt "] } \
48 gdb_assert
{ $Term
::_cur_row
== 20 }
51 with_test_prefix
"prompt size == width + 1: end of screen" {
52 Term
::clean_restart
24 40
54 if {![Term
::enter_tui
]} {
55 unsupported
"TUI not supported"
59 # Put prompt at last line.
60 Term
::command
"echo \\n\\n\\n\\n\\n\\n"
61 gdb_assert
{ $Term
::_cur_row
== 23 } "at last line"
63 set prompt
"123456789A123456789B123456789C123456789D>"
65 #
Set new prompt
, and
set old prompt
back.
66 send_gdb
"set prompt $prompt\n"
67 send_gdb
"set prompt (gdb) \n"
71 #
19 (gdb
) set prompt
123456789A123456789B123
72 #
20 456789C123456789D
>
73 #
21 123456789A123456789B123456789C123456789D
74 #
22 >set prompt
(gdb
)
77 gdb_assert
{ [Term
::wait_for
"^>set prompt $gdb_prompt "] } \
80 gdb_assert
{ $Term
::_cur_row
== 23 } "still at last line"
81 Term
::check_region_contents
"scrolling" 0 19 40 1 \
82 "^$gdb_prompt set prompt 123456789A123456789B123$"
85 with_test_prefix
"prompt size == width" {
86 Term
::clean_restart
24 40
88 if {![Term
::enter_tui
]} {
89 unsupported
"TUI not supported"
93 set prompt
"123456789A123456789B123456789C123456789>"
95 #
Set new prompt
, and
set old prompt
back.
96 send_gdb
"set prompt $prompt\n"
97 send_gdb
"set prompt (gdb) \n"
101 #
16 (gdb
) set prompt
123456789A123456789B123
102 #
17 456789C123456789
>
103 #
18 123456789A123456789B123456789C123456789
>
104 #
19 set prompt
(gdb
)
107 gdb_assert
{ [Term
::wait_for
"^set prompt $gdb_prompt "] } \
110 gdb_assert
{ $Term
::_cur_row
== 20 }
113 with_test_prefix
"prompt size == width - 1" {
114 Term
::clean_restart
24 40
116 if {![Term
::enter_tui
]} {
117 unsupported
"TUI not supported"
121 set prompt
"123456789A123456789B123456789C12345678>"
123 #
Set new prompt
, and
set old prompt
back.
124 send_gdb
"set prompt $prompt\n"
125 send_gdb
"set prompt (gdb) \n"
129 #
16 (gdb
) set prompt
123456789A123456789B123
130 #
17 456789C12345678
>
131 #
18 123456789A123456789B123456789C12345678
>s
135 gdb_assert
{ [Term
::wait_for
"^et prompt $gdb_prompt "] } \
138 gdb_assert
{ $Term
::_cur_row
== 20 }