diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2006-11-10 16:58:53 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2006-11-10 16:58:53 +0000 |
commit | d8295fe954b3f129fe3439aa17bb2c2be45d264c (patch) | |
tree | e6b39931532f4a68e365d612f49c0a50ca09b3a1 /gdb/testsuite/lib/gdb.exp | |
parent | 73ca250004d8918d3fdaef1ce59291e05770e898 (diff) | |
download | fsf-binutils-gdb-d8295fe954b3f129fe3439aa17bb2c2be45d264c.zip fsf-binutils-gdb-d8295fe954b3f129fe3439aa17bb2c2be45d264c.tar.gz fsf-binutils-gdb-d8295fe954b3f129fe3439aa17bb2c2be45d264c.tar.bz2 |
2006-11-10 Vladimir Prus <vladimir@codesourcery.com>
* gdb.base/completion.exp: Fix completion tests for
'info' and 'info '.
* gdb.base/help.exp (help_test_raw, test_class_help)
(test_prefix_command_help): Move...
* lib/gdb.exp: Here.
* gdb.base/main.exp: Adjust.
* gdb.cp/maint.exp: Adjust.
* gdb.trace/tracecmd.exp: Use test_help_class.
Diffstat (limited to 'gdb/testsuite/lib/gdb.exp')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 86c7e1d..3c1eb87 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2409,3 +2409,61 @@ proc gdb_gnu_strip_debug { dest args } { return 0 } +# Test the output of GDB_COMMAND matches the pattern obtained +# by concatenating all elements of EXPECTED_LINES. This makes +# it possible to split otherwise very long string into pieces. +# If third argument is not empty, it's used as the name of the +# test to be printed on pass/fail. +proc help_test_raw { gdb_command expected_lines args } { + set message $gdb_command + if [llength $args]>0 then { + set message [lindex $args 0] + } + set expected_output [join $expected_lines ""] + gdb_test "${gdb_command}" "${expected_output}" $message +} + +# Test the output of "help COMMNAD_CLASS". EXPECTED_INITIAL_LINES +# are regular expressions that should match the beginning of output, +# before the list of commands in that class. The presence of +# command list and standard epilogue will be tested automatically. +proc test_class_help { command_class expected_initial_lines args } { + set l_stock_body { + "List of commands\:.*\[\r\n\]+" + "Type \"help\" followed by command name for full documentation\.\[\r\n\]+" + "Type \"apropos word\" to search for commands related to \"word\"\.[\r\n\]+" + "Command name abbreviations are allowed if unambiguous\." + } + set l_entire_body [concat $expected_initial_lines $l_stock_body] + + eval [list help_test_raw "help ${command_class}" $l_entire_body] $args +} + +# COMMAND_LIST should have either one element -- command to test, or +# two elements -- abbreviated command to test, and full command the first +# element is abbreviation of. +# The command must be a prefix command. EXPECTED_INITIAL_LINES +# are regular expressions that should match the beginning of output, +# before the list of subcommands. The presence of +# subcommand list and standard epilogue will be tested automatically. +proc test_prefix_command_help { command_list expected_initial_lines args } { + set command [lindex $command_list 0] + if {[llength $command_list]>1} { + set full_command [lindex $command_list 1] + } else { + set full_command $command + } + # Use 'list' and not just {} because we want variables to + # be expanded in this list. + set l_stock_body [list\ + "List of $full_command subcommands\:.*\[\r\n\]+"\ + "Type \"help $full_command\" followed by $full_command subcommand name for full documentation\.\[\r\n\]+"\ + "Type \"apropos word\" to search for commands related to \"word\"\.\[\r\n\]+"\ + "Command name abbreviations are allowed if unambiguous\."] + set l_entire_body [concat $expected_initial_lines $l_stock_body] + if {[llength $args]>0} { + help_test_raw "help ${command}" $l_entire_body [lindex $args 0] + } else { + help_test_raw "help ${command}" $l_entire_body + } +} |