From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3] Tighten regexp of lib/completion-support.exp:test_gdb_complete_tab_multiple
Date: Wed, 13 Dec 2017 13:26:00 -0000 [thread overview]
Message-ID: <1513171596-10665-4-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1513171596-10665-1-git-send-email-palves@redhat.com>
While writing the tests included in the previous commit, I noticed
that test_gdb_complete_tab_multiple would not FAIL if GDB happens to
show more completions than expected before the expected list.
E.g., with something like this, expecting "p foo" to complete to
"foo2" and "foo3":
test_gdb_complete_tab_multiple "p foo" "" {
"foo2"
"foo3"
}
and then if foo actually completes to:
(gdb) p foo[TAB]
foo1 foo2 foo3
^^^^
we'd still PASS. (Note the spurious "foo1" above.)
This tightens the regexp with a beginning anchor thus making the
completions above cause a FAIL. Other similar functions in
completion-support.exp already do something like this; I had just
missed this one originally. Thankfully, this did not expose any
problems in the gdb.linespec/ tests. Phew.
gdb/testsuite/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* lib/completion-support.exp (test_gdb_complete_tab_multiple):
Tighten regexp by matching with an anchor.
---
gdb/testsuite/lib/completion-support.exp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index fe5b16a..bebf90e 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -139,9 +139,12 @@ proc test_gdb_complete_tab_multiple { input_line add_completed_line \
# extra tab to show the matches list.
if {$add_completed_line != ""} {
send_gdb "\t"
+ set maybe_bell ${completion::bell_re}
+ } else {
+ set maybe_bell ""
}
gdb_test_multiple "" "$test (second tab)" {
- -re "$expected_re\r\n$gdb_prompt $input_line_re$add_completed_line_re$" {
+ -re "^${maybe_bell}\r\n$expected_re\r\n$gdb_prompt $input_line_re$add_completed_line_re$" {
pass "$test"
}
}
--
2.5.5
next prev parent reply other threads:[~2017-12-13 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 13:26 [PATCH 0/3] Fix regression: expression completer and scope operator (PR gdb/22584) Pedro Alves
2017-12-13 13:26 ` [PATCH 1/3] Factor out final completion match string building Pedro Alves
2017-12-13 13:26 ` [PATCH 2/3] Fix regression: expression completer and scope operator (PR gdb/22584) Pedro Alves
2017-12-13 13:26 ` Pedro Alves [this message]
2017-12-13 15:58 ` [PATCH 0/3] " Simon Marchi
2017-12-13 16:41 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1513171596-10665-4-git-send-email-palves@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).