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 # Check tuiterm procs that interact with gdb as well as tuiterm.
20 proc test_accept_gdb_output { } {
21 if { $::action_cnt == [llength $::actions] } {
24 set action [lindex $::actions $::action_cnt]
32 proc test_send_gdb { string } {
33 set expected [lindex $::expect_send $::send_cnt]
34 gdb_assert { [string equal $string $expected] }
39 with_override Term::accept_gdb_output test_accept_gdb_output {
40 with_override send_gdb test_send_gdb {
42 foreach_with_prefix border { "" "|" } {
43 with_test_prefix "Term::command match" {
46 set expect_send { foo\n }
50 Term::_insert "${::border}(gdb) foo"
55 Term::_insert "${::border}(gdb) "
58 gdb_assert { [Term::command "foo"] }
61 with_test_prefix "Term::command mismatch" {
64 set expect_send { foo\n }
68 Term::_insert "$::border (gdb) foo"
73 Term::_insert "${::border}(gdb) "
76 gdb_assert { ![Term::command "foo"] }
79 with_test_prefix "Term::command mismatch 2" {
82 set expect_send { foo\n }
86 Term::_insert "${::border}(gdb) foo"
91 Term::_insert "${::border} (gdb) "
94 gdb_assert { ![Term::command "foo"] }
97 with_test_prefix Term::wait_for {
104 Term::_insert "(gdb) "
107 gdb_assert { [Term::wait_for ""] }