gbranden pushed a commit to branch master
in repository groff.

commit 86d6f1fcc57769411cb66c3e4feabadd57083337
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Jun 8 06:30:21 2025 -0500

    [pic]: Add unit test for `polygon` command.
    
    * src/preproc/pic/tests/polygon-command-works.sh: Do it.
    * src/src/preproc/pic/pic.am (pic_TESTS): Run test.
      (TESTS): Add test to suite.
      (EXTRA_DIST): Ship test in distribution archive.
---
 ChangeLog                                      |  9 +++++
 src/preproc/pic/pic.am                         |  7 +++-
 src/preproc/pic/tests/polygon-command-works.sh | 52 ++++++++++++++++++++++++++
 3 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 1a06a39c2..9b4e9a01d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-06-08  G. Branden Robinson <[email protected]>
+
+       [pic]: Add unit test for `polygon` command.
+
+       * src/preproc/pic/tests/polygon-command-works.sh: Do it.
+       * src/src/preproc/pic/pic.am (pic_TESTS): Run test.
+       (TESTS): Add test to suite.
+       (EXTRA_DIST): Ship test in distribution archive.
+
 2025-06-08  G. Branden Robinson <[email protected]>
 
        * src/preproc/pic/object.cpp (object::point): Fix compiler
diff --git a/src/preproc/pic/pic.am b/src/preproc/pic/pic.am
index 78b16715b..421ab7f1e 100644
--- a/src/preproc/pic/pic.am
+++ b/src/preproc/pic/pic.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
 #
 # This file is part of groff.
 #
@@ -47,6 +47,11 @@ EXTRA_DIST += \
 # Since pic_CPPFLAGS was set, all .o files have a 'pic-' prefix.
 src/preproc/pic/pic-lex.$(OBJEXT): src/preproc/pic/pic.hpp
 
+pic_TESTS = \
+  src/preproc/pic/tests/polygon-command-works.sh
+TESTS += $(pic_TESTS)
+EXTRA_DIST += $(pic_TESTS)
+
 uninstall_groffdirs: uninstall_pic_hook
 uninstall_pic_hook:
        -rmdir $(DESTDIR)$(tmacdir)
diff --git a/src/preproc/pic/tests/polygon-command-works.sh 
b/src/preproc/pic/tests/polygon-command-works.sh
new file mode 100755
index 000000000..440436baa
--- /dev/null
+++ b/src/preproc/pic/tests/polygon-command-works.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# Copyright (C) 2025 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/>.
+#
+
+pic="${abs_top_builddir:-.}/pic"
+
+fail=
+
+wail () {
+    echo ...FAILED >&2
+    fail=YES
+}
+
+# Smoke-test GNU pic `polygon` keyword extension.
+
+input='.
+.sp 2i
+.PS
+polygon up 1 then right 1 down 0.5 fill 0.5
+.PE
+.'
+
+output=$(echo "$input" | "$pic")
+printf "%s\n" "$output"
+
+echo "checking that polygon command draws stroked polygon" >&2
+printf "%s\n" "$output" \
+    | grep -Eq '\\D.p 0(\.0*)i -1(\.0*)i 1(\.0*)i 0.50*i.' || wail
+
+echo "checking that fill modifier draws filled polygon" >&2
+printf "%s\n" "$output" \
+    | grep -Eq '\\D.P 0(\.0*)i -1(\.0*)i 1(\.0*)i 0.50*i.' || wail
+
+test -z "$fail"
+
+# vim:set ai et sw=4 ts=4 tw=72:

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

Reply via email to