public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-6472] diagnostics: Fix up selftests with $COLUMNS < 42 [PR108973]
Date: Sat,  4 Mar 2023 08:49:28 +0000 (GMT)	[thread overview]
Message-ID: <20230304084928.8D5CE3858D28@sourceware.org> (raw)

https://gcc.gnu.org/g:739e7ebb3d378ece25d64b39baae47c584253498

commit r13-6472-g739e7ebb3d378ece25d64b39baae47c584253498
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Mar 4 09:48:17 2023 +0100

    diagnostics: Fix up selftests with $COLUMNS < 42 [PR108973]
    
    As mentioned in the PR, GCC's diagnostics self-tests fail if $COLUMNS < 42.
    Guarding each self-test with if (get_terminal_width () > 41) or similar
    would be a maintainance nightmare (PR has a patch to do so without
    reformatting to make it work for $COLUMNS in [30, 41] inclusive, but
    I'm afraid going down to $COLUMNS 1 would mean marking everything).
    Furthermore, the self-tests don't really emit stuff to the terminal,
    but into a buffer, so using get_terminal_width () for it seems
    inappropriate.  The following patch makes sure test_diagnostic_context
    constructor uses exactly 80 columns wide caret max width, of course
    some tests override it already if they want to test for behavior in narrower
    cases.
    
    2023-03-04  Jakub Jelinek  <jakub@redhat.com>
    
            PR testsuite/108973
            * selftest-diagnostic.cc
            (test_diagnostic_context::test_diagnostic_context): Set
            caret_max_width to 80.

Diff:
---
 gcc/selftest-diagnostic.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/selftest-diagnostic.cc b/gcc/selftest-diagnostic.cc
index 6ac9f46dd3c..6d1bd1bd792 100644
--- a/gcc/selftest-diagnostic.cc
+++ b/gcc/selftest-diagnostic.cc
@@ -41,6 +41,7 @@ test_diagnostic_context::test_diagnostic_context ()
   show_column = true;
   start_span = start_span_cb;
   min_margin_width = 6;
+  caret_max_width = 80;
 }
 
 test_diagnostic_context::~test_diagnostic_context ()

                 reply	other threads:[~2023-03-04  8:49 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=20230304084928.8D5CE3858D28@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.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).