aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-03-04 09:48:17 +0100
committerJakub Jelinek <jakub@redhat.com>2023-03-04 09:48:17 +0100
commit739e7ebb3d378ece25d64b39baae47c584253498 (patch)
tree1694fb2398b39447dfca26aa15f20a4cbf6565c1
parent53940eee08957b8b72ee70f57770398009e19c21 (diff)
downloadgcc-739e7ebb3d378ece25d64b39baae47c584253498.zip
gcc-739e7ebb3d378ece25d64b39baae47c584253498.tar.gz
gcc-739e7ebb3d378ece25d64b39baae47c584253498.tar.bz2
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.
-rw-r--r--gcc/selftest-diagnostic.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/selftest-diagnostic.cc b/gcc/selftest-diagnostic.cc
index 6ac9f46..6d1bd1b 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 ()