]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Add test for Term::with_term
authorTom de Vries <tdevries@suse.de>
Fri, 20 Mar 2026 09:13:27 +0000 (10:13 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 20 Mar 2026 09:13:27 +0000 (10:13 +0100)
Add a test for proc Term::with_term in gdb.tui/tuiterm.exp

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.tui/tuiterm.exp

index a4dc9ba89b5239c42de35be1c7c0f4d9c9478aa4..e23209ad1f7fd066d19fb267ebf862419efe8cef 100644 (file)
@@ -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