scdoc2mdoc

A fork of scdoc to output mdoc(7)
git clone git://git.sgregoratto.me/scdoc2mdoc
Log | Files | Refs | README | LICENSE

commit 3227b18a354d82c3fbd76ac28c7b18796e8be1d4
parent e5dec0cbd0b022fbe020c374a9f1f8d649657437
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 13 May 2018 20:03:09 -0400

Set up test suite

Diffstat:
MMakefile | 5++++-
Atest/lib.sh | 16++++++++++++++++
Atest/preamble | 44++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -41,4 +41,7 @@ install: all install -Dm755 scdoc $(BINDIR)/scdoc install -Dm644 scdoc.1 $(MANDIR)/man1/scdoc.1 -.PHONY: all clean install +check: scdoc scdoc.1 + @find test -executable -exec '{}' \; + +.PHONY: all clean install check diff --git a/test/lib.sh b/test/lib.sh @@ -0,0 +1,16 @@ +begin() { + printf '%-40s' "$1" +} + +scdoc() { + ./scdoc "$@" 2>&1 +} + +end() { + if [ $? -ne "$1" ] + then + printf 'FAIL\n' + else + printf 'OK\n' + fi +} diff --git a/test/preamble b/test/preamble @@ -0,0 +1,44 @@ +#!/bin/sh +. test/lib.sh + +begin "Expects a name" +scdoc <<EOF >/dev/null +(8) +EOF +end 1 + +begin "Expects a section" +scdoc <<EOF >/dev/null +test +EOF +end 1 + +begin "Expects name to alphanumeric" +scdoc <<EOF >/dev/null +____(8) +EOF +end 1 + +begin "Expects section to be a number" +scdoc <<EOF >/dev/null +test(hello) +EOF +end 1 + +begin "Expects section to legit" +scdoc <<EOF >/dev/null +test(100) +EOF +end 1 + +begin "Accepts a valid preamble" +scdoc <<EOF >/dev/null +test(8) +EOF +end 0 + +begin "Writes the appropriate header" +scdoc <<EOF | grep '^\.TH "test" "8" "'"$(date +'%F')"'"' >/dev/null +test(8) +EOF +end 0