From 3d649b90422a694ace9292e0afeab189e79734a0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 28 Aug 2024 16:38:28 +0200 Subject: [PATCH] more tests --- tests-markdown.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 5 deletions(-) diff --git a/tests-markdown.sh b/tests-markdown.sh index ae71068..f5fc829 100755 --- a/tests-markdown.sh +++ b/tests-markdown.sh @@ -8,16 +8,16 @@ fail() { printf '%s\n' "$@"; exit 1; } awk() { /bin/awk "$@"; } md() { awk -f markdown.awk "$@"; } -tcount=1 +acnt=1 # assertion count assert() { local md="$(printf '%s' "$1" |md)" comp="$2" msg="$3" - printf "%2i: %s ... " $tcount "$msg" + printf "%3i: %s ... " $acnt "$msg" if [ "$md" != "$comp" ]; then printf "Fail!\n:\n%s\n:\n%s\n" "$md" "$comp" exit 1 fi printf 'OK\n' - tcount=$((tcount + 1)) + acnt=$((acnt + 1)) } # Inline checks @@ -79,8 +79,86 @@ bar' \ 'paragraphs' assert '%meta *data block* - ignored `no` __formatting__' \ -'' \ + ignored `no` __formatting__ +regular *data*' \ +'

regular data

' \ "meta data block" +assert '> text in a block +> quote can be *emphasized* +and quotes continued + +until they end' \ +'

text in a block +quote can be emphasized +and quotes continued

+ +

until they end

' \ +'block quote' + +assert '| text in a line +| block can be *emphasized* +but not continued + +until they end' \ +'
text in a line
+block can be emphasized
+

but not continued

+ +

until they end

' \ +'pandoc line block' + +assert ' indented code will + not be + *formatted* + but ­ ' \ +'
indented code will
+not be
+*formatted*
+but &shy; <escaped>
' \ +"indented code block" + +assert ':::: tag +fenced _divs_ are regular text + +::: +and can contain another div +::: +::::' \ +'

fenced divs are regular text

+ +

and can contain another div

+
+
' \ +"pandoc fenced divs" + +assert '``` tag,code +fenced code will +not be +*formatted* +but ­ +```' \ +'
fenced code will
+not be
+*formatted*
+but &shy; <escaped>
' \ +"fenced code block" + +# Block Images +assert '![Testbild](Test Bild.jpg)' \ +'
Testbild
' \ +"block image" + +assert '![Testbild](Test Bild.jpg "German Television *test* image ca. 1994")' \ +'
Testbild
German Television test image ca. 1994
' \ +"inline image" + +assert '![Testbild *ARD*](Test Bild.jpg){tv ard function-check}' \ +'
Testbild *ARD*
' \ +"block image tagged" + +# assert '![Testbild *ARD*](Test Bild.jpg){#tv .ard .function-check}' \ +# '
Testbild *ARD*
' \ +# "block image tagged" + printf '\nAll test passed!\n' -- 2.39.2