[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 02/16: [tests]: Add more grohtml smoke tests.
From: |
G. Branden Robinson |
Subject: |
[groff] 02/16: [tests]: Add more grohtml smoke tests. |
Date: |
Wed, 14 Dec 2022 21:12:13 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit fc8215a32f196d5b5bdedf15bcabd74dabcae1f0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Dec 13 03:10:36 2022 -0600
[tests]: Add more grohtml smoke tests.
* src/roff/groff/tests/smoke-test_html_device.sh: Add checks for
inlining of images when tbl(1) or eqn(1) used.
Prompted by observation of delicate interaction of `ps4html` and `P`
registers in man(7) pages.
---
ChangeLog | 5 +++
src/roff/groff/tests/smoke-test_html_device.sh | 54 ++++++++++++++++++++++----
2 files changed, 51 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4b2c770d8..a08782a4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-12-13 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/groff/tests/smoke-test_html_device.sh: Add checks for
+ inlining of images when tbl(1) or eqn(1) used.
+
2022-12-12 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/andoc.tmac (reload-man): Unplant `doc-break-body-text`
diff --git a/src/roff/groff/tests/smoke-test_html_device.sh
b/src/roff/groff/tests/smoke-test_html_device.sh
index c58d8ea41..63fb27a8b 100755
--- a/src/roff/groff/tests/smoke-test_html_device.sh
+++ b/src/roff/groff/tests/smoke-test_html_device.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2020 Free Software Foundation, Inc.
+# Copyright (C) 2020, 2022 Free Software Foundation, Inc.
#
# This file is part of groff.
#
@@ -20,20 +20,58 @@
groff="${abs_top_builddir:-.}/test-groff"
-# We can't run these tests if the environment doesn't support UTF-8.
-test "$(locale charmap)" = UTF-8 || exit 77 # skip
+fail=
+
+wail () {
+ echo ...FAILED >&2
+ fail=yes
+}
+
+cleanup () {
+ rm -f grohtml-[0-9]*-[12].png
+}
+
+trap 'trap - HUP INT QUIT TERM; cleanup; kill -s INT $$' \
+ HUP INT QUIT TERM
+
+input='.TS
+L.
+foobar
+.TE'
+
+# Inline images are named grohtml-$$-<image sequence number>.png.
-set -e
+echo "checking production of inline image for tbl(1) table" >&2
+output=$(echo "$input" | "$groff" -t -Thtml)
+echo "$output" | grep -q '<img src="grohtml-[0-9]\+-1.png"' || wail
+
+input='.EQ
+x sup 2 + y sup 2 = z sup 2
+.EN'
+
+echo "checking production of inline image for eqn(1) equation" >&2
+output=$(echo "$input" | "$groff" -e -Thtml)
+echo "$output" | grep -q '<img src="grohtml-[0-9]\+-2.png"' || wail
+
+# We can't run remaining tests if the environment doesn't support UTF-8.
+test "$(locale charmap)" = UTF-8 || exit 77 # skip
# Check two forms of character transformation.
#
# dash's built-in printf doesn't support \x or \u escapes, so likely
# other shells don't either, and expecting one that does to be in the
# $PATH seems optimistic. So use UTF-8 octal bytes directly.
-echo "testing -k -Thtml" >&2
-printf '\303\241' | "$groff" -k -Thtml | grep -qx '<p>á</p>'
+echo "checking -k -Thtml" >&2
+printf '\303\241' | "$groff" -k -Thtml | grep -qx '<p>á</p>' \
+ || wail
# We test compatibility-mode HTML output somewhat differently since
# preconv only emits groffish \[uXXXX] escapes for non-ASCII codepoints.
-echo "testing -C -k -Thtml" >&2
-printf "\('a" | "$groff" -C -k -Thtml | grep -qx '<p>á</p>'
+echo "checking -C -k -Thtml" >&2
+printf "\('a" | "$groff" -C -k -Thtml | grep -qx '<p>á</p>' \
+ || wail
+
+cleanup
+test -z "$fail"
+
+# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 02/16: [tests]: Add more grohtml smoke tests.,
G. Branden Robinson <=