From: Paul Hänsch Date: Thu, 29 Aug 2024 11:23:28 +0000 (+0200) Subject: additional checks, check different awk implementations X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=d8f6cfff96d05bf495fb1146f6873910261d1f3f;p=cgilite additional checks, check different awk implementations --- diff --git a/tests-markdown.sh b/tests-markdown.sh index 0147f09..a6bb361 100755 --- a/tests-markdown.sh +++ b/tests-markdown.sh @@ -6,16 +6,23 @@ CR="$(printf \r)" fail() { printf '%s\n' "$@"; exit 1; } awk() { /bin/awk "$@"; } -md() { awk -f markdown.awk "$@"; } +md_gawk() { gawk -f markdown.awk "$@"; } +md_bawk() { busybox awk -f markdown.awk "$@"; } +md_mawk() { mawk -f markdown.awk "$@"; } acnt=1 # assertion count assert() { - local md="$(printf '%s' "$1" |md)" comp="$2" msg="$3" + local md comp="$2" msg="$3" printf "%3i: %s ... " $acnt "$msg" - if [ "$md" != "$comp" ]; then - printf "Fail!\n:\n%s\n:\n%s\n" "$md" "$comp" - exit 1 - fi + + for proc in gawk bawk; do + printf '%s ' $proc + md="$(printf '%s' "$1" |md_"$proc")" + if [ "$md" != "$comp" ]; then + printf "Fail!\n:\n%s\n:\n%s\n" "$md" "$comp" + exit 1 + fi + done printf 'OK\n' acnt=$((acnt + 1)) } @@ -127,7 +134,7 @@ and can contain another div ::::' \ '

fenced divs are regular text

-

and can contain another div

+

and can contain another div

' \ "pandoc fenced divs" @@ -224,4 +231,46 @@ with line continuation ' \ 'Definition List' +assert ' * list +* item + 1. sub list +* three +- new list' \ +' +' \ +'Lists' + +assert '::: outer div +Nesting paragraph + +------- + +> ``` +> quoted code +> ``` +> +> > quoted quote +::: +' \ +'

Nesting paragraph

+ +
+ +
quoted code
+

quoted quote

+
+ +
' \ +"Nesting" + printf '\nAll test passed!\n'