aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-11-25 00:09:25 +0000
committerPedro Alves <palves@redhat.com>2017-11-25 00:09:25 +0000
commit6a3c6ee41898743234d8fd9f9cab15f2ecdaba49 (patch)
treeabf8f8fafd9bd927a453164f5787055fbb4e9c6f /gdb/testsuite/lib
parent13450e7c7fdbdb9b25aae68c60475d061ed427d3 (diff)
downloadgdb-6a3c6ee41898743234d8fd9f9cab15f2ecdaba49.zip
gdb-6a3c6ee41898743234d8fd9f9cab15f2ecdaba49.tar.gz
gdb-6a3c6ee41898743234d8fd9f9cab15f2ecdaba49.tar.bz2
Add comprehensive C++ operator linespec/location/completion tests
This exercises the special handling C++ operators require in several places in the linespec parser, both the linespec and explicit location completers, symbol lookup, etc. Particularly, makes sure all that works without quoting. Note that despite the apparent smallish size, this adds thousands of tests to the testsuite, due to combination explosion (linespecs, explicit locations, tab completion, complete command, completion at different points in each function, etc.) Grows the gdb.linespec/ tests like this: -# of expected passes 3464 +# of expected passes 7823 gdb/testsuite/ChangeLog: 2017-11-25 Pedro Alves <palves@redhat.com> * gdb.linespec/cpls-ops.cc: New file. * gdb.linespec/cpls-ops.exp: New file. * lib/completion-support.exp (test_complete_prefix_range_re): New, factored out from ... (test_complete_prefix_range): ... this.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/completion-support.exp23
1 files changed, 16 insertions, 7 deletions
diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index 70e6aec..25332cc 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -259,21 +259,30 @@ proc test_gdb_complete_multiple { cmd_prefix completion_word add_completed_line
test_gdb_complete_cmd_multiple $cmd_prefix $completion_word $completion_list $start_quote_char $end_quote_char
}
-# Test that all the substring prefixes of COMPLETION from [0..START)
-# to [0..END) complete to COMPLETION. If END is ommitted, default to
-# the length of COMPLETION.
+# Test that all the substring prefixes of INPUT from [0..START) to
+# [0..END) complete to COMPLETION_RE (a regular expression). If END
+# is ommitted, default to the length of INPUT.
-proc test_complete_prefix_range {completion start {end -1}} {
+proc test_complete_prefix_range_re {input completion_re start {end -1}} {
if {$end == -1} {
- set end [string length $completion]
+ set end [string length $input]
}
for {set i $start} {$i < $end} {incr i} {
- set line [string range $completion 0 $i]
- test_gdb_complete_unique "$line" "$completion"
+ set line [string range $input 0 $i]
+ test_gdb_complete_unique_re "$line" $completion_re
}
}
+# Test that all the substring prefixes of COMPLETION from [0..START)
+# to [0..END) complete to COMPLETION. If END is ommitted, default to
+# the length of COMPLETION.
+
+proc test_complete_prefix_range {completion start {end -1}} {
+ set completion_re [string_to_regexp $completion]
+ test_complete_prefix_range_re $completion $completion_re $start $end
+}
+
# Find NEEDLE in HAYSTACK and return the index _after_ NEEDLE. E.g.,
# searching for "(" in "foo(int)" returns 4, which would be useful if
# you want to find the "(" to try completing "foo(".