[binutils-gdb] [gdb/testsuite] Add test for Term::with_term

Tom de Vries via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0bc36a972246017ecf58da2a0a2aa83378496212

commit 0bc36a972246017ecf58da2a0a2aa83378496212
Author: Tom de Vries <[email protected]>
Date:   Fri Mar 20 10:13:27 2026 +0100

    [gdb/testsuite] Add test for Term::with_term
    
    Add a test for proc Term::with_term in gdb.tui/tuiterm.exp
    
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/testsuite/gdb.tui/tuiterm.exp | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp
index a4dc9ba89b5..e23209ad1f7 100644
--- a/gdb/testsuite/gdb.tui/tuiterm.exp
+++ b/gdb/testsuite/gdb.tui/tuiterm.exp
@@ -802,6 +802,25 @@ proc test_attrs {} {
     gdb_assert { [string equal $line "<reverse:1>a<reverse:0>a  "] }
 }
 
+proc_with_prefix test_with_term {} {
+    with_test_prefix pre {
+	gdb_assert {$Term::_TERM == ""}
+    }
+
+    set pre_env $::env(TERM)
+    Term::with_term foo {
+	Term::with_tuiterm 24 80 {
+	    gdb_assert {$::env(TERM) == "foo"}
+	    gdb_assert {$Term::_TERM == "foo"}
+	}
+    }
+
+    with_test_prefix post {
+	gdb_assert {$::env(TERM) == $pre_env}
+	gdb_assert {$Term::_TERM == ""}
+    }
+}
+
 # Run proc TEST_PROC_NAME with a "small" terminal.
 
 proc run_one_test_small { test_proc_name } {
@@ -856,3 +875,5 @@ foreach_with_prefix test {
 }
 
 test_attrs
+
+test_with_term
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.