gbranden pushed a commit to branch master
in repository groff.

commit 663ac037d98b8a2428b11fd7811226ff60d6451c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Aug 30 04:25:55 2024 -0500

    [groff]: Test diags on invalid grout attempts.
    
    [groff]: Add test of diagnostics for attempts to write invalid things to
    device-independent output.  We don't generally write tests for invalid
    or incorrect input, but this particular area has been a sore and poorly
    understood point for a long time.
    
    * src/roff/groff/tests/unencodable-things-in-grout.sh: Do it.
    * src/roff/groff/groff.am (groff_TESTS): Run test.
    
    Continues fixing Savannah #63074.
---
 ChangeLog                                          | 12 +++++++
 src/roff/groff/groff.am                            |  1 +
 .../groff/tests/unencodable-things-in-grout.sh     | 41 ++++++++++++++++++++++
 3 files changed, 54 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c3431a5e3..b326172a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-08-30  G. Branden Robinson <[email protected]>
+
+       [groff]: Add test of diagnostics for attempts to write invalid
+       things to device-independent output.  We don't generally write
+       tests for invalid or incorrect input, but this particular area
+       has been a sore and poorly understood point for a long time.
+
+       * src/roff/groff/tests/unencodable-things-in-grout.sh: Do it.
+       * src/roff/groff/groff.am (groff_TESTS): Run test.
+
+       Continues fixing Savannah #63074.
+
 2024-08-30  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index ac472207d..9c04b6735 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -88,6 +88,7 @@ groff_TESTS = \
   src/roff/groff/tests/string_case_xform_requests.sh \
   src/roff/groff/tests/string_case_xform_unicode_escape.sh \
   src/roff/groff/tests/substring_works.sh \
+  src/roff/groff/tests/unencodable-things-in-grout.sh \
   src/roff/groff/tests/use_point_size_escape_with_single_digit_arg.sh
 TESTS += $(groff_TESTS)
 EXTRA_DIST += $(groff_TESTS)
diff --git a/src/roff/groff/tests/unencodable-things-in-grout.sh 
b/src/roff/groff/tests/unencodable-things-in-grout.sh
new file mode 100755
index 000000000..1b695b34a
--- /dev/null
+++ b/src/roff/groff/tests/unencodable-things-in-grout.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+groff="${abs_top_builddir:-.}/test-groff"
+
+fail=
+
+wail () {
+  echo ...FAILED >&2
+  fail=YES
+}
+
+for esc in '\\h@1m@' '\\[nonexistent]' '\\[u0FF]'
+do
+  printf "checking that escape sequence '%s' produces a warning\n" \
+    "$esc" >&2
+  error=$(printf "\\X'$esc'\n" | "$groff" -W w -w char -z 2>&1)
+  echo "$error"
+  echo "$error" | grep -q 'warning:' || fail
+done
+
+test -z "$fail"
+
+# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to