scdoc2mdoc

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

preamble (1495B)


      1 #!/bin/sh
      2 . test/lib.sh
      3 
      4 begin "Expects a name"
      5 scdoc <<EOF >/dev/null
      6 (8)
      7 EOF
      8 end 1
      9 
     10 begin "Expects a section"
     11 scdoc <<EOF >/dev/null
     12 test
     13 EOF
     14 end 1
     15 
     16 begin "Expects name to alphanumeric"
     17 scdoc <<EOF >/dev/null
     18 !!!!(8)
     19 EOF
     20 end 1
     21 
     22 begin "Expects section to be a number"
     23 scdoc <<EOF >/dev/null
     24 test(hello)
     25 EOF
     26 end 1
     27 
     28 begin "Expects section to legit"
     29 scdoc <<EOF >/dev/null
     30 test(100)
     31 EOF
     32 end 1
     33 
     34 begin "Accepts a valid preamble"
     35 scdoc <<EOF >/dev/null
     36 test(8)
     37 EOF
     38 end 0
     39 
     40 # Make sure SOURCE_DATE_EPOCH is not set for the next tests
     41 unset SOURCE_DATE_EPOCH
     42 
     43 begin "Writes the appropriate header"
     44 scdoc <<EOF | grep '^\.TH "test" "8" "'"$(date +'%F')"'"' >/dev/null
     45 test(8)
     46 EOF
     47 end 0
     48 
     49 begin "Preserves dashes"
     50 scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date +'%F')"'"' >/dev/null
     51 test-manual(8)
     52 EOF
     53 end 0
     54 
     55 begin "Handles extra footer field"
     56 scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date +'%F')"'" "Footer"' >/dev/null
     57 test-manual(8) "Footer"
     58 EOF
     59 end 0
     60 
     61 begin "Handles both extra fields"
     62 scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date +'%F')"'" "Footer" "Header"' >/dev/null
     63 test-manual(8) "Footer" "Header"
     64 EOF
     65 end 0
     66 
     67 begin "Emits empty footer correctly"
     68 scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date +'%F')"'" "" "Header"' >/dev/null
     69 test-manual(8) "" "Header"
     70 EOF
     71 end 0
     72 
     73 export TZ=UTC
     74 export SOURCE_DATE_EPOCH="1512861537"
     75 
     76 begin "Supports \$SOURCE_DATE_EPOCH"
     77 scdoc <<EOF | grep '^\.TH "reproducible-manual" "8" "2017-12-09"' >/dev/null
     78 reproducible-manual(8)
     79 EOF
     80 end 0