[RFC PATCH 01/12] doc: add test for doc tools output

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

 



Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 t/t0600-doc-tools.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)
 create mode 100755 t/t0600-doc-tools.sh

diff --git a/t/t0600-doc-tools.sh b/t/t0600-doc-tools.sh
new file mode 100755
index 0000000000..0f9a4053a9
--- /dev/null
+++ b/t/t0600-doc-tools.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+test_description='Check the output of documentation tools'
+
+. ./test-lib.sh
+
+doc_dir="$GIT_BUILD_DIR/Documentation"
+
+command -v asciidoc >/dev/null && test_set_prereq ASCIIDOC
+command -v asciidoctor >/dev/null && test_set_prereq ASCIIDOCTOR
+
+cat >git-foo.txt <<EOF
+git-foo(1)
+===========
+
+NAME
+----
+git-foo - Test command
+
+SYNOPSIS
+--------
+[verse]
+'git-foo' [<arg>]
+
+DESCRIPTION
+-----------
+description
+
+GIT
+---
+Part of the linkgit:git[1] suite
+EOF
+
+cat >git-foo.1.expected <<EOF
+'\" t
+.TH "GIT\-FOO" "1" "2005\-01\-01" "Git 1\&.0\&.0" "Git Manual"
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
+.nh
+.ad l
+.SH "NAME"
+git-foo \- Test command
+.SH "SYNOPSIS"
+.sp
+.nf
+\fIgit\-foo\fR [<arg>]
+.fi
+.sp
+.SH "DESCRIPTION"
+.sp
+description
+.SH "GIT"
+.sp
+Part of the \fBgit\fR(1) suite
+EOF
+
+xmltoman() {
+	base="$1"
+	shift
+	xmlto --skip-validation -m "$doc_dir/manpage-normal.xsl" -m "$doc_dir/manpage-bold-literal.xsl" "$@" man "$base.xml"
+}
+
+build_asciidoc_py() {
+	asciidoc -f "$doc_dir/asciidoc.conf" -amanmanual='Git Manual' -amansource='Git 1.0.0' -arevdate='2005-01-01' -b docbook -d manpage \
+		-o "$1.xml" "$1.txt" &&
+	xmltoman "$1"
+}
+
+build_asciidoctor() {
+	asciidoctor -acompat-mode -atabsize=8 -I "$doc_dir" -rasciidoctor-extensions -alitdd='&#x2d;&#x2d;' \
+		-amanmanual='Git Manual' -amansource='Git 1.0.0' -arevdate='2005-01-01' -b docbook5 -d manpage \
+		-o "$1.xml" "$1.txt" &&
+	xmltoman "$1" -x "$doc_dir"/manpage.xsl
+}
+
+check_manpage() {
+	sed -e '/^\.\\"/d' -e '/^$/d' "$1.1" >"$1.1.actual" &&
+	test_cmp "$1.1.expected" "$1.1.actual"
+}
+
+test_expect_failure ASCIIDOC 'legacy asciidoc.py' '
+	build_asciidoc_py "git-foo" &&
+	check_manpage "git-foo"
+'
+
+test_expect_failure ASCIIDOCTOR 'modern asciidoctor (docbook5)' '
+	build_asciidoctor "git-foo" &&
+	check_manpage "git-foo"
+'
+
+test_done
-- 
2.40.0+fc1




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux