[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 10/44: [groff]: Update code style of test.
From: |
G. Branden Robinson |
Subject: |
[groff] 10/44: [groff]: Update code style of test. |
Date: |
Tue, 3 Sep 2024 08:05:41 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit d8641e9e355f2e2b55c01bf376ed59cda097efe0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Sep 1 23:58:00 2024 -0500
[groff]: Update code style of test.
* src/roff/groff/tests/dot-cp_register_works.sh: Migrate to more recent
test conventions. Use `fail` variable and `wail()` function instead
of `set -e`. Report more status. Add Vim modeline.
---
src/roff/groff/tests/dot-cp_register_works.sh | 39 +++++++++++++++++++++------
1 file changed, 31 insertions(+), 8 deletions(-)
diff --git a/src/roff/groff/tests/dot-cp_register_works.sh
b/src/roff/groff/tests/dot-cp_register_works.sh
index ffbb402bd..963ab8d31 100755
--- a/src/roff/groff/tests/dot-cp_register_works.sh
+++ b/src/roff/groff/tests/dot-cp_register_works.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2020 Free Software Foundation, Inc.
+# Copyright (C) 2020-2024 Free Software Foundation, Inc.
#
# This file is part of groff.
#
@@ -20,7 +20,15 @@
groff="${abs_top_builddir:-.}/test-groff"
-DOC='.pl 1v
+fail=
+
+wail () {
+ echo ...FAILED >&2
+ fail=YES
+}
+
+input='.
+.pl 1v
A
.do if 1 \n[.cp] \" Get initial compatibility state (depends on -C).
B
@@ -37,12 +45,27 @@ E
.cp 0
F
.if !\n[.C] \n[.cp] \" Outside of .do context, should return -1.
-'
+.'
+
+# Expected:
+#
+# A 0 B 0 C 1 D 0 E 1 F 0
+# A 1 B 1 C 1 D 0 E 1 F 0
+
+output=$(printf "%s" "$input" | "$groff" -T ascii)
+echo "$output"
+
+echo "checking value of '.cp' when not started in compatibility mode" \
+ >&2
+echo "$output" | grep -Fqx "A 0 B 0 C 1 D 0 E 1 F -1" || wail
+
+output=$(printf "%s" "$input" | "$groff" -C -T ascii)
+echo "$output"
-set -e
+echo "checking value of '.cp' when started in compatibility mode" \
+ >&2
+echo "$output" | grep -Fqx "A 1 B 1 C 1 D 0 E 1 F -1" || wail
-printf "%s" "$DOC" | "$groff" -Tascii \
- | grep -x "A 0 B 0 C 1 D 0 E 1 F -1"
+test -z "$fail"
-printf "%s" "$DOC" | "$groff" -C -Tascii \
- | grep -x "A 1 B 1 C 1 D 0 E 1 F -1"
+# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 10/44: [groff]: Update code style of test.,
G. Branden Robinson <=