public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Maciej W. Rozycki <macro@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] GDB/testsuite: Add coverage for `print -elements' command
Date: Thu,  7 Jul 2022 11:04:29 +0000 (GMT)	[thread overview]
Message-ID: <20220707110429.A252E385B83D@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=309e147fbd26a433ec3a1e2cd346633bb615de29

commit 309e147fbd26a433ec3a1e2cd346633bb615de29
Author: Maciej W. Rozycki <macro@embecosm.com>
Date:   Thu Jul 7 12:00:18 2022 +0100

    GDB/testsuite: Add coverage for `print -elements' command
    
    We currently have no coverage for the `print -elements ...' command (or
    `p -elements ...' in the shortened form), so add a couple of test cases
    mimicking ones using corresponding `set print elements ...' values.

Diff:
---
 gdb/testsuite/gdb.base/printcmds.exp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 0a99f3d6f27..60b9de47e52 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -536,6 +536,15 @@ proc test_print_strings {} {
     gdb_test "p teststring" \
 	" = (.unsigned char .. )?\"teststring contents\"" "p teststring with elements set to 20"
 
+    gdb_test "p -elements 1 -- teststring" \
+	" = (.unsigned char .. )?\"t\"\\.\\.\\."
+    gdb_test "p -elements 5 -- teststring" \
+	" = (.unsigned char .. )?\"tests\"\\.\\.\\."
+    gdb_test "p -elements 19 -- teststring" \
+	" = (.unsigned char .. )?\"teststring contents\""
+    gdb_test "p -elements 20 -- teststring" \
+	" = (.unsigned char .. )?\"teststring contents\""
+
     gdb_test "print teststring2" \
 	" = \\(charptr\\) \"more contents\""


                 reply	other threads:[~2022-07-07 11:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220707110429.A252E385B83D@sourceware.org \
    --to=macro@sourceware.org \
    --cc=gdb-cvs@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).