2003-04-15 David Carlton <carlton@math.stanford.edu>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.c++ / maint.exp
1 # Copyright 2003 Free Software Foundation Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
19
20
21 # This file tests C++-specific maintenance commands and help on those.
22
23 # Currently, no source file is used.
24
25 if $tracelevel then {
26 strace $tracelevel
27 }
28
29 # Test the help messages.
30
31 proc test_help {} {
32 gdb_test "help maintenance cplus" "C\\+\\+ maintenance commands.\r\n\r\nList of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- Print the first class/namespace component of NAME\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous."
33
34 gdb_test "help maint cp" "C\\+\\+ maintenance commands.\r\n\r\nList of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- Print the first class/namespace component of NAME\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous."
35
36 gdb_test "maint cp" "\"maintenance cplus\" must be followed by the name of a command.\r\nList of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- Print the first class/namespace component of NAME\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous."
37
38 gdb_test "help maint cp first_component" "Print the first class/namespace component of NAME."
39 }
40
41 # This is used when NAME should contain only a single component. Be
42 # careful to make sure that parentheses get escaped properly.
43 proc test_single_component {name} {
44 set matchname [string_to_regexp "$name"]
45 gdb_test "maint cp first_component $name" "$matchname"
46 }
47
48 proc test_first_component {} {
49 test_single_component "foo"
50 test_single_component "operator<<"
51 test_single_component "operator>>"
52 test_single_component "operator ->"
53 test_single_component "operator()"
54 test_single_component "operator>"
55 test_single_component "operator<"
56 test_single_component "operator ->"
57 test_single_component "operator ->"
58
59 test_single_component "foo()"
60 test_single_component "foo(int)"
61 test_single_component "foo(X::Y)"
62 test_single_component "foo(X::Y, A::B)"
63 test_single_component "foo(std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >)"
64 test_single_component "operator>(X::Y)"
65
66 gdb_test "maint cp first_component foo::bar" "foo"
67 gdb_test "maint cp first_component foo::bar::baz" "foo"
68 gdb_test "maint cp first_component C<A>::bar" "C<A>"
69 gdb_test "maint cp first_component C<std::basic_streambuf<wchar_t,std::char_traits<wchar_t> > >::bar" "C<std::basic_streambuf<wchar_t,std::char_traits<wchar_t> > >"
70 }
71
72 gdb_exit
73 gdb_start
74
75 test_help
76 test_first_component
77
78 gdb_exit
79 return 0
This page took 0.031646 seconds and 4 git commands to generate.