aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-09-23 09:56:51 -0400
committerSimon Marchi <simon.marchi@efficios.com>2021-10-28 11:17:45 -0400
commitc0492bea7ca33fafc280f08f4ed9f505d29e7130 (patch)
tree573f368c19b8c952d10b85deb697296d0822a263 /gdb/testsuite/gdb.gdb
parent8c2999954bd3aa5853f553eb6a050dd38e6d9029 (diff)
downloadfsf-binutils-gdb-c0492bea7ca33fafc280f08f4ed9f505d29e7130.zip
fsf-binutils-gdb-c0492bea7ca33fafc280f08f4ed9f505d29e7130.tar.gz
fsf-binutils-gdb-c0492bea7ca33fafc280f08f4ed9f505d29e7130.tar.bz2
gdb: add selftest name completion
After the previous commit, it is easy to add completion for selftest names. Again, this is not particularly high value, but I rarely touched completion, so it served as a simple example to get some practice. Change the for_each_selftest_ftype parameter to gdb::function_view, so that we can pass a lambda that captures things. Change-Id: I87cac299ddca9ca7eb0ffab78342e850a98d954c
Diffstat (limited to 'gdb/testsuite/gdb.gdb')
-rw-r--r--gdb/testsuite/gdb.gdb/unittest.exp15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.gdb/unittest.exp b/gdb/testsuite/gdb.gdb/unittest.exp
index 670205f..0ddd206 100644
--- a/gdb/testsuite/gdb.gdb/unittest.exp
+++ b/gdb/testsuite/gdb.gdb/unittest.exp
@@ -20,6 +20,8 @@ if [gdb_debug_enabled] {
return 0
}
+load_lib completion-support.exp
+
set do_xml_test [expr ![gdb_skip_xml_test]]
standard_testfile
@@ -59,6 +61,17 @@ proc run_selftests { binfile } {
}
}
+# Test completion of command "maintenance selftest".
+
+proc_with_prefix test_completion {} {
+ clean_restart
+ test_gdb_complete_tab_multiple "maintenance selftest string_v" "" \
+ {string_vappendf string_view string_vprintf}
+ test_gdb_complete_tab_unique "maintenance selftest string_vie" "maintenance selftest string_view" " "
+ test_gdb_complete_tab_unique "maintenance selftest -ver" "maintenance selftest -verbose" " "
+ test_gdb_complete_tab_none "maintenance selftest name_that_does_not_exist"
+}
+
with_test_prefix "no executable loaded" {
run_selftests ""
}
@@ -67,6 +80,8 @@ with_test_prefix "executable loaded" {
run_selftests ${binfile}
}
+test_completion
+
if { ![is_remote host] && $do_xml_test } {
gdb_test "maintenance check xml-descriptions ${srcdir}/../features" \
"Tested $decimal XML files, 0 failed" \