Add some more tests

master
Drew DeVault 7 years ago
parent 3227b18a35
commit 9b8ecbe992
  1. 34
      test/heading
  2. 34
      test/inline-formatting
  3. 3
      test/lib.sh

@ -0,0 +1,34 @@
#!/bin/sh
. test/lib.sh
begin "Fail on ###"
scdoc <<EOF >/dev/null
test(8)
### this is not a valid heading
EOF
end 1
begin "Expects a space after #"
scdoc <<EOF >/dev/null
test(8)
#needs a space there
EOF
end 1
begin "Emits a new section"
scdoc <<EOF | grep '^\.SH HEADER' >/dev/null
test(8)
# HEADER
EOF
end 0
begin "Emits a new subsection"
scdoc <<EOF | grep '^\.SS HEADER' >/dev/null
test(8)
## HEADER
EOF
end 0

@ -0,0 +1,34 @@
#!/bin/sh
. test/lib.sh
begin "Disallows nested formatting"
scdoc <<EOF >/dev/null
test(8)
_hello *world*_
EOF
end 1
begin "Emits bold text"
scdoc <<EOF | grep '^hello \\fBworld\\fR' >/dev/null
test(8)
hello *world*
EOF
end 0
begin "Emits underlined text"
scdoc <<EOF | grep '^hello \\fIworld\\fR' >/dev/null
test(8)
hello _world_
EOF
end 0
begin "Handles escaped characters"
scdoc <<EOF | grep '^hello _world_' >/dev/null
test(8)
hello \_world\_
EOF
end 0

@ -1,3 +1,6 @@
printf '== %s\n' "$0"
trap "printf '\n'" EXIT
begin() {
printf '%-40s' "$1"
}

Loading…
Cancel
Save