gbranden pushed a commit to branch master
in repository groff.

commit d1106736829bbcef50827e2435a5735757881e1e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Dec 19 23:14:08 2025 -0600

    [groff]: Improve delimiter test script.
    
    * src/roff/groff/tests/check-delimiter-validity.sh: Improve tests.
      Clarify progress messages to distinguish escape sequence, title
      request, and output comparison contexts.  Test two characters ('@',
      '_') that weren't tested before because I ran out of steam.  Test
      delimiters used with title requests and output comparisons even when
      not in compatibility mode.  Also cosmetically sort big lists to
      vertically align punctuation characters that aren't significant in
      numeric expressions, pairing them up by low-order bits of their ISO
      646 code points.
---
 ChangeLog                                        |  12 +++
 src/roff/groff/tests/check-delimiter-validity.sh | 105 +++++++++++++++++++----
 2 files changed, 99 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f8e137783..ec11cbd4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2025-12-19  G. Branden Robinson <[email protected]>
+
+       * src/roff/groff/tests/check-delimiter-validity.sh: Improve
+       tests.  Clarify progress messages to distinguish escape
+       sequence, title request, and output comparison contexts.  Test
+       two characters ('@', '_') that weren't tested before because I
+       ran out of steam.  Test delimiters used with title requests and
+       output comparisons even when not in compatibility mode.  Also
+       cosmetically sort big lists to vertically align punctuation
+       characters that aren't significant in numeric expressions,
+       pairing them up by low-order bits of their ISO 646 code points.
+
 2025-12-07  Alejandro Colomar <[email protected]>
 
        * src/libs/libgroff/uniglyph.cpp:
diff --git a/src/roff/groff/tests/check-delimiter-validity.sh 
b/src/roff/groff/tests/check-delimiter-validity.sh
index 8fcd4dd2c..fc02522d3 100755
--- a/src/roff/groff/tests/check-delimiter-validity.sh
+++ b/src/roff/groff/tests/check-delimiter-validity.sh
@@ -26,23 +26,24 @@ wail () {
   fail=YES
 }
 
-# not tested: '_' (because it's part of our delimited expression)
 for c in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
          a b c d e f g h i j k l m n o p q r s t u v w x y z \
          '!' '"' '#' '$' "'" ',' ';' '?' \
-         '@' '[' ']' '^' '`' '{' '}' '~'
+         '@' '[' ']' '^' '_' \
+         '`' '{' '}' '~'
 do
-    echo "checking validity of '$c' as delimiter when not in" \
-        "compatbility mode" >&2
-    output=$(printf '\\l%c1n+2n\\&_%c\n' "$c" "$c" \
+    echo "checking validity of '$c' as escape sequence delimiter" \
+        "when not in compatbility mode" >&2
+    output=$(printf '\\l%c1n+2n\\&0%c\n' "$c" "$c" \
       | "$groff" -w delim -T ascii | sed '/^$/d')
-    echo "$output" | grep -Fqx ___ || wail
+    echo "$output" | grep -Fqx 000 || wail
 done
 
 for octal in 001 002 003 004 005 006 007 010 011 014 177
 do
     echo "checking validity of control character $octal (octal)" \
-        "as delimiter when not in compatibility mode" >&2
+        "as escape sequence delimiter when not in compatibility mode" \
+        >&2
     output=$(printf '\\l\'$octal'1n+2n\&_\'$octal'\n' \
       | "$groff" -w delim -T ascii | sed '/^$/d')
     echo "$output" | grep -Fqx ___ || wail
@@ -50,25 +51,86 @@ done
 
 for c in 0 1 2 3 4 5 6 7 8 9 + - '(' . '|'
 do
-    echo "checking invalidity of '$c' as delimiter when not in" \
-        "compatbility mode" >&2
+    echo "checking invalidity of '$c' as escape sequence delimiter" \
+        "when not in compatbility mode" >&2
+    output=$(printf '\\l%c1n+2n\\&_%c\n' "$c" "$c" \
+      | "$groff" -w delim -T ascii | sed '/^$/d')
+    echo "$output" | grep -qx 1n+2n_. || wail
+done
+
+for c in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
+         a b c d e f g h i j k l m n o p q r s t u v w x y z \
+         '!' '"' '#' '$' "'" ',' ';' '?' \
+         '@' '[' ']' '^' '_' \
+         '`' '{' '}' '~'
+do
+    echo "checking validity of '$c' as title request delimiter" \
+        "when not in compatbility mode" >&2
+    output=$(printf '.tl %c1%c2%c3%c\n' "$c" "$c" "$c" "$c" \
+      | "$groff" -w delim -T ascii | sed '/^$/d')
+    echo "$output" | grep -Eqx '1 +2 +3' || wail
+done
+
+for octal in 001 002 003 004 005 006 007 010 011 014 177
+do
+    echo "checking validity of control character $octal (octal)" \
+        "as title request delimiter when not in compatibility mode" \
+        >&2
+    output=$(printf '.tl \'$octal'1\'$octal'2\'$octal'3\'$octal'\n' \
+      | "$groff" -w delim -T ascii | sed '/^$/d')
+    echo "$output" | grep -Eqx '1 +2 +3' || wail
+done
+
+for c in 0 1 2 3 4 5 6 7 8 9 + - '(' . '|'
+do
+    echo "checking invalidity of '$c' as escape sequence delimiter" \
+        "when not in compatbility mode" >&2
     output=$(printf '\\l%c1n+2n\\&_%c\n' "$c" "$c" \
       | "$groff" -w delim -T ascii | sed '/^$/d')
     echo "$output" | grep -qx 1n+2n_. || wail
 done
 
+# TODO: Future: Savannah #66009
+#for c in 0 1 2 3 4 5 6 7 8 9 + - '(' . '|'
+#do
+#    echo "checking invalidity of '$c' as title request delimiter" \
+#        "when not in compatbility mode" >&2
+#    output=$(printf '.tl %cA%cB%cC%c\n' "$c" "$c" "$c" "$c" \
+#      | "$groff" -w delim -T ascii | sed '/^$/d')
+#    echo "$output" | grep -Eqx 'A +B +C' && wail
+#done
+
+# excluded: conditional expression operators
+for c in A B C D E   G H I J K L M N O P Q R   T U V W X Y Z \
+         a b       f g h i j k l       p q   s   u   w x y z \
+             '"' '#' '$' "'" ',' ';' '?' \
+         '@' '[' ']' '^' '_' \
+         '`' '{' '}' '~'
+do
+    echo "checking validity of '$c' as output comparison delimiter" \
+         "when not in compatibility mode" >&2
+    output=$(printf '.if %c***%c***%c ***\n' "$c" "$c" "$c" \
+      | "$groff" -w delim -T ascii | sed '/^$/d')
+    echo "$output" | grep -Fqx '***' || wail
+done
+
 # Regression-test Savannah #67744.
-echo "checking invalidity of \h as delimiter when not in" \
-        "compatibility mode" >&2
+echo "checking invalidity of \h as escape sequence delimiter" \
+    "when not in compatibility mode" >&2
 output=$(printf 'foo\\C\\h"1m"em\\h"1m"bar\n' \ | "$groff" -T ascii -a)
 echo "$output" | grep -Fqx "foo--bar" && wail
 
+# TODO: Check invalidity of \C as escape sequence delimiter when not in
+# compatibility mode.  See comment #27 of Savannah #67372.
+
 # Test invalid delimiters to `read_delimited_name()`.
 
+# TODO: We can restore the validity of these.  See comment #27 of
+# Savannah #67372.
 for c in '0' '^' '|'
 do
-    echo "checking invalidity of '$c' as name delimiter in normal" \
-        "mode" >&2
+    echo "checking invalidity of '$c' as escape sequence delimiter" \
+        "when not in compatibility mode" >&2
     output=$(printf 'foo\\C\\%cem\\%cbar\n' "$c" "$c" \
       | "$groff" -T ascii -a | sed '/^$/d')
     echo "$output" | grep -Fqx "foo--bar" && wail
@@ -81,7 +143,8 @@ for c in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
\
          a b c d e f g h i j k l m n o p q r s t u v w x y z \
          0 1 2 3 4 5 6 7 8 9 + - / '*' % '<' '>' = '&' : '(' ')' . '|' \
          '!' '"' '#' '$' "'" ',' ';' '?' \
-         '@' '[' ']' '^' '`' '{' '}' '~'
+         '@' '[' ']' '^' \
+         '`' '{' '}' '~'
 do
     echo "checking validity of '$c' as string expression delimiter" \
          "in compatibility mode" >&2
@@ -90,6 +153,13 @@ do
     echo "$output" | grep -Fqx ___ || wail
 done
 
+# Check the leftover '_'.
+echo "checking validity of '_' as string expression delimiter" \
+    "in compatibility mode" >&2
+output=$(printf '\\o_**_**\n' \
+  | "$groff" -C -w delim -T ascii -P -cbou | sed '/^$/d')
+echo "$output" | grep -Fqx '***' || wail
+
 for octal in 002 003 005 006 007 177
 do
     echo "checking validity of control character $octal (octal)" \
@@ -144,16 +214,15 @@ done
 # to treat 'v' as an AT&Tism or a GNUism.
 #for c in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
 #         a b c d   f g h i j k l m     p q r s   u v w x y z
-# not tested: '!' (because it's a conditional expression operator)
-# not tested: '@' (because it's part of our delimited expression)
 for c in A B C D E   G H I J K L M N O P Q R   T U V W X Y Z \
          a b       f g h i j k l       p q   s   u   w x y z \
              '"' '#' '$' "'" ',' ';' '?' \
-             '[' ']' '^' '`' '{' '}' '~'
+         '@' '[' ']' '^' '_' \
+         '`' '{' '}' '~'
 do
     echo "checking validity of '$c' as output comparison delimiter" \
          "in compatibility mode" >&2
-    output=$(printf '.if %c@@@%c@@@%c ___\n' "$c" "$c" "$c" \
+    output=$(printf '.if %c***%c***%c ___\n' "$c" "$c" "$c" \
       | "$groff" -C -w delim -T ascii | sed '/^$/d')
     echo "$output" | grep -Fqx ___ || wail
 done

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

Reply via email to