Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.tui / long-prompt.exp
blob1116b570d065caabc07735acd090ded69036397b
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
17 # TUI.
19 require allow_tui_tests
21 tuiterm_env
23 with_test_prefix "prompt size == width + 1" {
24     Term::clean_restart 24 40
26     if {![Term::enter_tui]} {
27         unsupported "TUI not supported"
28         return
29     }
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"
37     # Expected output:
38     #
39     #   16 (gdb) set prompt 123456789A123456789B123
40     #   17 456789C123456789D>
41     #   18 123456789A123456789B123456789C123456789D
42     #   19 >set prompt (gdb)
43     #   20 (gdb)
45     gdb_assert { [Term::wait_for "^>set prompt $gdb_prompt "] } \
46         "got prompt back"
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"
56         return
57     }
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"
69     # Expected output:
70     #
71     # 19 (gdb) set prompt 123456789A123456789B123
72     # 20 456789C123456789D>
73     # 21 123456789A123456789B123456789C123456789D
74     # 22 >set prompt (gdb)
75     # 23 (gdb)
77     gdb_assert { [Term::wait_for "^>set prompt $gdb_prompt "] } \
78         "got prompt back"
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"
90         return
91     }
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"
99     # Expected output:
100     #
101     #   16 (gdb) set prompt 123456789A123456789B123
102     #   17 456789C123456789>
103     #   18 123456789A123456789B123456789C123456789>
104     #   19 set prompt (gdb)
105     #   20 (gdb)
107     gdb_assert { [Term::wait_for "^set prompt $gdb_prompt "] } \
108         "got prompt back"
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"
118         return
119     }
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"
127     # Expected output:
128     #
129     #   16 (gdb) set prompt 123456789A123456789B123
130     #   17 456789C12345678>
131     #   18 123456789A123456789B123456789C12345678>s
132     #   19 et prompt (gdb)
133     #   20 (gdb)
135     gdb_assert { [Term::wait_for "^et prompt $gdb_prompt "] } \
136         "got prompt back"
138     gdb_assert { $Term::_cur_row == 20 }