diff options
author | Keith Seitz <keiths@redhat.com> | 2009-08-24 22:01:30 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2009-08-24 22:01:30 +0000 |
commit | 676accff0e356cd123b1224d2cb84c8d3ddc6a70 (patch) | |
tree | 7db49654038ae84765182661738a8dc17d85029c /gdb/testsuite | |
parent | 95699ff03777ac5edb51a8f7680d14e3cde9c56b (diff) | |
download | gdb-676accff0e356cd123b1224d2cb84c8d3ddc6a70.zip gdb-676accff0e356cd123b1224d2cb84c8d3ddc6a70.tar.gz gdb-676accff0e356cd123b1224d2cb84c8d3ddc6a70.tar.bz2 |
* gdb.cp/cpcompletion.exp (test_class_complete): New procedure.
Add two new C++ completer tests which limit the output to a
given class.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/cpcompletion.exp | 42 |
2 files changed, 48 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4a7454a..7f2c839 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-08-24 Keith Seitz <keiths@redhat.com> + + * gdb.cp/cpcompletion.exp (test_class_complete): New procedure. + Add two new C++ completer tests which limit the output to a + given class. + 2009-08-24 Michael Snyder <msnyder@vmware.com> * gdb.base/del.exp: Fix typo in comment. diff --git a/gdb/testsuite/gdb.cp/cpcompletion.exp b/gdb/testsuite/gdb.cp/cpcompletion.exp index bccf051..5aaae03 100644 --- a/gdb/testsuite/gdb.cp/cpcompletion.exp +++ b/gdb/testsuite/gdb.cp/cpcompletion.exp @@ -15,6 +15,40 @@ # This file is part of the gdb testsuite. +# A helper procedure to test location completions restricted by +# class. +proc test_class_complete {class expr name matches} { + global gdb_prompt + + set matches [lsort $matches] + set cmd "complete break ${class}::$expr" + set seen {} + gdb_test_multiple $cmd $name { + "break ${class}::main" { fail "$name (saw global symbol)" } + $cmd { exp_continue } + -re "break ${class}::\[A-Za-z0-9_~\]+" { + set str $expect_out(0,string) + scan $str "break ${class}::%\[^(\]" method + lappend seen $method + exp_continue + } + -re "$gdb_prompt $" { + set failed "" + foreach got [lsort $seen] have $matches { + if {![string equal $got $have]} { + set failed $have + break + } + } + if {[string length $failed] != 0} { + fail "$name ($failed not found)" + } else { + pass $name + } + } + } +} + if $tracelevel then { strace $tracelevel } @@ -58,3 +92,11 @@ gdb_test "complete p foo1.Fo" "p foo1\\.Foofoo" # Test completion with an anonymous struct. gdb_test "complete p a.g" "p a\\.get" + +# Test that completion is restricted by class name (all methods) +test_class_complete Foo "" "complete class methods" \ + [list Foo Foofoo get_foo set_foo ~Foo] + +test_class_complete Foo F "complete class methods beginning with F" \ + [list Foo Foofoo] + |