| 1 | #!/bin/sh |
| 2 | . test/lib.sh |
| 3 | |
| 4 | begin "Fail on ###" |
| 5 | scdoc <<EOF >/dev/null |
| 6 | test(8) |
| 7 | |
| 8 | ### this is not a valid heading |
| 9 | EOF |
| 10 | end 1 |
| 11 | |
| 12 | begin "Expects a space after #" |
| 13 | scdoc <<EOF >/dev/null |
| 14 | test(8) |
| 15 | |
| 16 | #needs a space there |
| 17 | EOF |
| 18 | end 1 |
| 19 | |
| 20 | begin "Emits a new section" |
| 21 | scdoc <<EOF | grep '^\.SH HEADER' >/dev/null |
| 22 | test(8) |
| 23 | |
| 24 | # HEADER |
| 25 | EOF |
| 26 | end 0 |
| 27 | |
| 28 | begin "Emits a new subsection" |
| 29 | scdoc <<EOF | grep '^\.SS HEADER' >/dev/null |
| 30 | test(8) |
| 31 | |
| 32 | ## HEADER |
| 33 | EOF |
| 34 | end 0 |
| 35 | |
| 36 | begin "Escapes hyphens in headings" |
| 37 | scdoc <<EOF | grep '^\.SH HEADING \\-\\-head \\-h 2026\\-02\\-11' >/dev/null |
| 38 | test(8) |
| 39 | |
| 40 | # HEADING --head -h 2026-02-11 |
| 41 | EOF |
| 42 | end 0 |