gdb_test_no_output "set max-completions 5"
-set test "command-name completion limiting using tab character"
-send_gdb "p\t"
-gdb_test_multiple "" "$test" {
- -re "^p\\\x07$" {
- send_gdb "\t"
- gdb_test_multiple "" "$test" {
- -re "List may be truncated, max-completions reached.*\r\n$gdb_prompt p$" {
- # Complete the command and ignore the output to resync
- # gdb for the next test.
- send_gdb "\n"
- gdb_test_multiple "" "$test" {
- -re "$gdb_prompt $" {
- pass "$test"
- }
+proc ignore_and_resync {cmd result test} {
+ global gdb_prompt
+
+ gdb_test_multiple "" "$test" {
+ -re "^${cmd}$" {
+ # Complete the command and ignore the output
+ # to resync gdb for the next test.
+ send_gdb "\n"
+ gdb_test_multiple "" "$test" {
+ -re "$gdb_prompt $" {
+ $result $test
}
}
- -re "$gdb_prompt p$" {
- # Complete the command and ignore the output to resync
- # gdb for the next test.
- send_gdb "\n"
- gdb_test_multiple "" "$test" {
- -re "$gdb_prompt $" {
- fail "$test"
- }
+ }
+ }
+}
+
+proc test_tab_complete {cmd test} {
+ global gdb_prompt
+
+ send_gdb "${cmd}\t"
+ gdb_test_multiple "" "$test" {
+ -re "^${cmd}\\\x07$" {
+ send_gdb "\t"
+ gdb_test_multiple "" "$test" {
+ -re "List may be truncated, max-completions reached.*\r\n$gdb_prompt " {
+ ignore_and_resync $cmd pass $test
+ }
+ -re "$gdb_prompt " {
+ ignore_and_resync $cmd fail $test
}
}
- }
+ }
}
}
+test_tab_complete "p" \
+ "command-name completion limiting using tab character"
+
set test "command-name completion limiting using complete command"
send_gdb "complete p\n"
gdb_test_multiple "" "$test" {
gdb_test_no_output "set max-completions 3"
-set test "symbol-name completion limiting using tab character"
-send_gdb "p marker\t"
-gdb_test_multiple "" "$test" {
- -re "^p marker\\\x07$" {
- send_gdb "\t"
- gdb_test_multiple "" "$test" {
- -re "List may be truncated, max-completions reached.*\r\n$gdb_prompt p marker$" {
- # Complete the command and ignore the output to resync
- # gdb for the next test.
- send_gdb "\n"
- gdb_test_multiple "" "$test" {
- -re "$gdb_prompt $" {
- pass "$test"
- }
- }
- }
- -re "$gdb_prompt p marker$" {
- # Complete the command and ignore the output to resync
- # gdb for the next test.
- send_gdb "\n"
- gdb_test_multiple "" "$test" {
- -re "$gdb_prompt $" {
- fail "$test"
- }
- }
- }
- }
- }
-}
+test_tab_complete "p marker" \
+ "symbol-name completion limiting using tab character"
set test "symbol-name completion limiting using complete command"
send_gdb "complete p mark\n"