aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2025-08-16 09:18:45 +0200
committerTom de Vries <tdevries@suse.de>2025-08-16 09:18:45 +0200
commit96265ee7fa3fcc3532a323cac74e3828df331114 (patch)
treeee6962e3d141eb4ddf5aab3cfb02a69052a2eea7
parent28daddd33accbfc519a2663a4e1bfaa66eafcef0 (diff)
downloadbinutils-96265ee7fa3fcc3532a323cac74e3828df331114.zip
binutils-96265ee7fa3fcc3532a323cac74e3828df331114.tar.gz
binutils-96265ee7fa3fcc3532a323cac74e3828df331114.tar.bz2
[gdb/testsuite] Move setting of Term::_last_char to Term::_insert
The variable Term::_last_char is meant to represent the last char inserted by Term::_insert, but setting it is done alongside the only call to _insert in lib/tuiterm.exp: ... _insert $expect_out(0,string) variable _last_char set _last_char [string index $expect_out(0,string) end] ... Fix this by moving the setting of _last_char to inside _insert. Tested on x86_64-linux.
-rw-r--r--gdb/testsuite/gdb.tui/tuiterm.exp16
-rw-r--r--gdb/testsuite/lib/tuiterm.exp5
2 files changed, 15 insertions, 6 deletions
diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp
index 6cd65f3..ed9478a 100644
--- a/gdb/testsuite/gdb.tui/tuiterm.exp
+++ b/gdb/testsuite/gdb.tui/tuiterm.exp
@@ -653,13 +653,21 @@ proc test_cursor_backward_tabulation { } {
}
proc test_repeat { } {
- Term::_move_cursor 2 1
- set Term::_last_char X
+ Term::_move_cursor 0 1
+
+ Term::_insert "xxX"
+ gdb_assert { $Term::_last_char == "X" }
+ check "insert" {
+ "abcdefgh"
+ "xxXlmnop"
+ "qrstuvwx"
+ "yz01234 "
+ } 3 1
- Term::_csi_b 3
+ Term::_csi_b 2
check "repeat" {
"abcdefgh"
- "ijXXXnop"
+ "xxXXXnop"
"qrstuvwx"
"yz01234 "
} 5 1
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 4ef3dc0..d622003 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -889,6 +889,9 @@ proc Term::_insert {str} {
}
}
}
+
+ variable _last_char
+ set _last_char [string index $str end]
}
}
@@ -1042,8 +1045,6 @@ proc Term::accept_gdb_output { } {
}
-re "^\[^\x07\x08\x0a\x0d\x1b\]+" {
_insert $expect_out(0,string)
- variable _last_char
- set _last_char [string index $expect_out(0,string) end]
}
timeout {