groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 34/37: [troff]: Add regression test for Savannah #66255.


From: G. Branden Robinson
Subject: [groff] 34/37: [troff]: Add regression test for Savannah #66255.
Date: Fri, 27 Sep 2024 01:18:15 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit cfc265c5fd4e4f83c02267ffa18faf32be645fd1
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Sep 26 23:35:45 2024 -0500

    [troff]: Add regression test for Savannah #66255.
    
    * src/roff/groff/tests/write-request-handles-empty-second-arg.sh: Do it.
    * src/roff/groff/groff.am (groff_TESTS): Run test.
    
    Test fails at this commit.
---
 ChangeLog                                          |  8 +++
 src/roff/groff/groff.am                            |  3 +-
 .../write-request-handles-empty-second-arg.sh      | 61 ++++++++++++++++++++++
 3 files changed, 71 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 4d89e8d4e..cc1f869ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-09-26  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [troff]: Add regression test for Savannah #66255.
+
+       * src/roff/groff/tests/\
+       write-request-handles-empty-second-arg.sh: Do it.
+       * src/roff/groff/groff.am (groff_TESTS): Run test.
+
 2024-09-26  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp (close_all_streams): Drop
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 9fb262493..351d5b316 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -93,7 +93,8 @@ groff_TESTS = \
   src/roff/groff/tests/stringup-request-transforms-non-basic-latin.sh \
   src/roff/groff/tests/substring-request-works.sh \
   src/roff/groff/tests/sy-request-works.sh \
-  src/roff/groff/tests/unencodable-things-in-grout.sh
+  src/roff/groff/tests/unencodable-things-in-grout.sh \
+  src/roff/groff/tests/write-request-handles-empty-second-arg.sh
 TESTS += $(groff_TESTS)
 EXTRA_DIST += $(groff_TESTS)
 
diff --git a/src/roff/groff/tests/write-request-handles-empty-second-arg.sh 
b/src/roff/groff/tests/write-request-handles-empty-second-arg.sh
new file mode 100755
index 000000000..4e79b9592
--- /dev/null
+++ b/src/roff/groff/tests/write-request-handles-empty-second-arg.sh
@@ -0,0 +1,61 @@
+#!/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
+}
+
+# Regression-test Savannah #66255.
+
+tmpfile=savannah-66255.txt
+
+cleanup () {
+  rm -f $tmpfile
+}
+
+trap 'trap - HUP INT QUIT TERM; cleanup; kill -INT $$' HUP INT QUIT TERM
+
+input='.
+.open mystream '$tmpfile'
+.write mystream a
+.write mystream b
+.write mystream
+.write mystream c
+.close mystream
+.'
+
+output=$(echo "$input" | "$groff" -U)
+od -c $tmpfile
+
+echo "verifying presence of desired text in output file" >&2
+grep -qx 'c' $tmpfile || wail
+
+echo "verifying absence of garbage text in output file" >&2
+grep -q 'write' $tmpfile && wail
+
+cleanup
+test -z "$fail"
+
+# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]