aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormakepost <makepost@firemail.cc>2019-04-28 17:00:31 +0300
committerRob Landley <rob@landley.net>2019-04-29 17:15:11 -0500
commit07a716b167ef6b21f82c86b026dc0f8fdd385c6f (patch)
tree3f78dcf9ff392838a0acfc409d593716f5b13e41 /tests
parent2794b23fb331a1f69807d04defa2c2c21d02c588 (diff)
downloadtoybox-07a716b167ef6b21f82c86b026dc0f8fdd385c6f.tar.gz
Search name and first line with man -k regex.
Exec -k value as regex on basename, and on the first content line outside a tag or on a referenced see-other, whichever appears earlier. Reuse zcat choice as a function when looping over files. Fix \-\- and glob.h include leftover. Handle man-pages example newlines. Clarify the todos, naming package and issue. Remaining items are more of a wishlist than a plan. Remove `<1>2` because it doesn't let `-k .` work, please look into that.
Diffstat (limited to 'tests')
-rw-r--r--tests/man.test31
1 files changed, 27 insertions, 4 deletions
diff --git a/tests/man.test b/tests/man.test
index f261437c..65b8a06f 100644
--- a/tests/man.test
+++ b/tests/man.test
@@ -16,6 +16,7 @@ echo five > banana/man5/numbers.5
testing "man" "$MAN numbers" " one\n\n" "" ""
testing "man.section" "$MAN numbers.3" " three\n\n" "" ""
testing "section man" "$MAN 5 numbers" " five\n\n" "" ""
+testing "/" "$MAN /" "" "" "" # Regression guard for !suf in zopen
cat >banana/man1/toybox.1 <<EOF
.TP
@@ -27,7 +28,7 @@ cat >banana/man1/toybox.1 <<EOF
Does something.
.TP
.PD 0
-.B \\-\\^\\-no\\-alias
+.B \\-\\-no\\-alias
Has no alias.
EOF
@@ -129,6 +130,14 @@ EOF
testing "bash nroff" "$MAN toybox" " Copyright (C) 2019\n\n" "" ""
cat >banana/man1/toybox.1 <<EOF
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+.EE
+EOF
+testing "stat example" "$MAN toybox" "#include <stdio.h>\n#include <stdlib.h>\n\n\n" "" ""
+
+cat >banana/man1/toybox.1 <<EOF
(...)
.PP
(...)
@@ -183,9 +192,23 @@ cat >banana/man1/toybox.1 <<EOF
EOF
testing "bash,git garbage" "$MAN toybox" "" "" ""
-# TODO: -k
+# "bash,git garbage" from above has no content, -k skips it.
+bzip2 >banana/man1/numbers.1.bz2 <<EOF
+.TH NUMBERS 1 "2019 Apr 28" "Toybox Manual"
+.SH NAME
+man \- test -k
+.SH ANOTHER SECTION
+.so noop.1
+Skip this text.
+EOF
+echo "No dash." | gzip >banana/man3/numbers.3.gz
+echo .so man1/numbers.1 >banana/man5/numbers.5
+testing "-k ." "$MAN -k ." "numbers.1.bz2 - test -k\nnumbers.3.gz - No dash.\nnumbers.5 - See numbers.1\n" "" ""
+testing "-k -k" "$MAN -k -k" "numbers.1.bz2 - test -k\n" "" ""
+testing "-k d.*h" "$MAN -k 'd.*h'" "numbers.3.gz - No dash.\n" "" ""
+testing "-k ers.1" "$MAN -k ers.1" "numbers.1.bz2 - test -k\nnumbers.5 - See numbers.1\n" "" ""
+
# TODO: emerge section header newline
-# TODO: fdm not roff
-# TODO: git-pull consecutive escaped slashes
+# TODO: fdm,man-pages man1p/, .nf, rare tags
rm -rf banana