Rework all of the test cases so they use tests/functions.sh,

which gives me the ability to do verbose and nonverbose test
suite running (`VERBOSE=1 make test` is the traditional output
now, and `make test` just gives pass/fail on each .t file)
This commit is contained in:
David Parsons
2010-02-11 23:13:29 -08:00
parent b7559c65b7
commit 3aa4343255
35 changed files with 227 additions and 814 deletions
+4 -23
View File
@@ -1,28 +1,8 @@
./echo 'Reddit-style automatic links'
. tests/functions.sh
title 'Reddit-style automatic links'
rc=0
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try -fautolink 'single link' \
'http://www.pell.portland.or.us/~orc/Code/discount' \
'<p><a href="http://www.pell.portland.or.us/~orc/Code/discount">http://www.pell.portland.or.us/~orc/Code/discount</a></p>'
@@ -43,4 +23,5 @@ try -fautolink 'parenthesised (url)' \
try -fautolink 'token with trailing @' 'orc@' '<p>orc@</p>'
summary $0
exit $rc
+4 -34
View File
@@ -1,41 +1,10 @@
./echo "automatic links"
. tests/functions.sh
title "automatic links"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
match() {
./echo -n " $1" '..................................' | ./cols 36
if ./echo "$2" | ./markdown | grep "$3" >/dev/null; then
./echo " ok"
else
./echo " FAILED"
rc=1
fi
}
try 'http url' '<http://here>' '<p><a href="http://here">http://here</a></p>'
try 'ftp url' '<ftp://here>' '<p><a href="ftp://here">ftp://here</a></p>'
match '<orc@pell.portland.or.us>' '<orc@pell.portland.or.us>' '<a href='
@@ -50,4 +19,5 @@ match '<mailto:orc@pell.com>' '<mailto:orc@pell.com>' '<a href='
match '<mailto:orc@>' '<mailto:orc@>' '<a href='
match '<mailto:@pell>' '<mailto:@pell>' '<a href='
summary $0
exit $rc
+4 -23
View File
@@ -1,29 +1,10 @@
./echo "backslash escapes"
. tests/functions.sh
title "backslash escapes"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got: $Q"
rc=1
fi
}
try 'backslashes in []()' '[foo](http://\this\is\.a\test\(here\))' \
'<p><a href="http://\this\is.a\test(here)">foo</a></p>'
@@ -31,5 +12,5 @@ try -fautolink 'autolink url with trailing \' \
'http://a.com/\' \
'<p><a href="http://a.com/\">http://a.com/\</a></p>'
summary $0
exit $rc
+4 -23
View File
@@ -1,30 +1,10 @@
./echo "callbacks"
. tests/functions.sh
title "callbacks"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try -bZZZ 'url modification' \
'[a](/b)' \
'<p><a href="ZZZ/b">a</a></p>'
@@ -33,4 +13,5 @@ try -EZZZ 'additional flags' \
'[a](/b)' \
'<p><a href="/b" ZZZ>a</a></p>'
summary $0
exit $rc
+4 -23
View File
@@ -1,30 +1,10 @@
./echo "code blocks"
. tests/functions.sh
title "code blocks"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'format for code block html' \
' this is
code' \
@@ -36,4 +16,5 @@ try 'unclosed single backtick' '`hi there' '<p>`hi there</p>'
try 'unclosed double backtick' '``hi there' '<p>``hi there</p>'
try 'remove space around code' '`` hi there ``' '<p><code>hi there</code></p>'
summary $0
exit $rc
+4 -22
View File
@@ -1,29 +1,10 @@
./echo "markdown 1.0 compatability"
. tests/functions.sh
title "markdown 1.0 compatability"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
LINKY='[this] is a test
[this]: /this'
@@ -44,4 +25,5 @@ try -f1.0 'trailing whitespace (-f1.0)' "$WHITESPACE" '<pre><code>white space''
and more
</code></pre>'
summary $0
exit $rc
+18 -45
View File
@@ -1,57 +1,30 @@
./echo "crashes"
. tests/functions.sh
title "crashes"
rc=0
MARKDOWN_FLAGS=
./echo -n ' zero-length input ................ '
try 'zero-length input' '' ''
if ./markdown < /dev/null >/dev/null; then
./echo "ok"
else
./echo "FAILED"
rc=1
fi
try 'hanging quote in list' \
' * > this should not die
./echo -n ' hanging quote in list ............ '
no.' \
'<ul>
<li><blockquote><p>this should not die</p></blockquote></li>
</ul>
./markdown >/dev/null 2>/dev/null << EOF
* > this should not die
no.
EOF
<p>no.</p>'
if [ "$?" -eq 0 ]; then
./echo "ok"
else
./echo "FAILED"
rc=1
fi
try 'dangling list item' ' - ' \
'<ul>
<li></li>
</ul>'
./echo -n ' dangling list item ............... '
if ./echo ' - ' | ./markdown >/dev/null 2>/dev/null; then
./echo "ok"
else
./echo "FAILED"
rc=1
fi
./echo -n ' empty []() with baseurl .......... '
if ./markdown -bHOHO -s '[]()' >/dev/null 2>/dev/null; then
./echo "ok"
else
./echo "FAILED"
rc=1
fi
./echo -n ' unclosed html block .............. '
if ./echo '<table></table' | ./markdown >/dev/null 2>/dev/null; then
./echo 'ok'
else
./echo "FAILED"
rc=1
fi
try -bHOHO 'empty []() with baseurl' '[]()' '<p><a href=""></a></p>'
try 'unclosed html block' '<table></table' '<table></table'
summary $0
exit $rc
+4 -24
View File
@@ -1,32 +1,12 @@
./markdown -V | grep DIV >/dev/null || exit 0
./echo "%div% blocks"
. tests/functions.sh
title "%div% blocks"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'simple >%div% block' \
'>%this%
this this' \
@@ -63,5 +43,5 @@ more' \
<div class="more"><p>more</p></div>'
summary $0
exit $rc
+4 -22
View File
@@ -1,29 +1,10 @@
./echo "definition lists"
. tests/functions.sh
title "definition lists"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
SRC='
=this=
is an ugly
@@ -66,4 +47,5 @@ else
fi
summary $0
exit $rc
+4 -23
View File
@@ -1,30 +1,10 @@
./echo "emphasis"
. tests/functions.sh
title "emphasis"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try '*hi* -> <em>hi</em>' '*hi*' '<p><em>hi</em></p>'
try '* -> *' 'A * A' '<p>A * A</p>'
try -fstrict '***A**B*' '***A**B*' '<p><em><strong>A</strong>B</em></p>'
@@ -37,4 +17,5 @@ if ./markdown -V | grep RELAXED >/dev/null; then
try -fstrict '_A_B with -fstrict' '_A_B' '<p><em>A</em>B</p>'
fi
summary $0
exit $rc
+4 -23
View File
@@ -1,30 +1,10 @@
./echo "paragraph flow"
. tests/functions.sh
title "paragraph flow"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'header followed by paragraph' \
'###Hello, sailor###
And how are you today?' \
@@ -49,4 +29,5 @@ try 'two lists punctuated with a HR' \
<li>C</li>
</ul>'
summary $0
exit $rc
+4 -22
View File
@@ -1,29 +1,10 @@
./echo "footnotes"
. tests/functions.sh
title "footnotes"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'a line with multiple []s' '[a][] [b][]:' '<p>[a][] [b][]:</p>'
try 'a valid footnote' \
'[alink][]
@@ -31,4 +12,5 @@ try 'a valid footnote' \
[alink]: link_me' \
'<p><a href="link_me">alink</a></p>'
summary $0
exit $rc
+77
View File
@@ -0,0 +1,77 @@
__tests=0
__passed=0
__failed=0
__title=
title() {
__title="$*"
if [ "$VERBOSE" ]; then
./echo "$__title"
else
./echo -n "$__title" \
'.................................................................' | ./cols 54
fi
}
summary() {
if [ -z "$VERBOSE" ]; then
if [ $__failed -eq 0 ]; then
./echo " OK"
else
./echo
./echo "$1: $__tests tests; $__failed failed/$__passed passed"
./echo
fi
fi
}
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
testcase=`./echo -n " $1" '..................................' | ./cols 36`
__tests=`expr $__tests + 1`
test "$VERBOSE" && ./echo -n "$testcase"
case "$2" in
-t*) Q=`./markdown $FLAGS "$2"` ;;
*) Q=`./echo "$2" | ./markdown $FLAGS` ;;
esac
if [ "$3" = "$Q" ]; then
__passed=`expr $__passed + 1`
test $VERBOSE && ./echo " ok"
else
__failed=`expr $__failed + 1`
if [ -z "$VERBOSE" ]; then
./echo
./echo "$1"
fi
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
match() {
testcase=`./echo -n " $1" '..................................' | ./cols 36`
test $VERBOSE && ./echo -n "$testcase"
if ./echo "$2" | ./markdown | grep "$3" >/dev/null; then
test $VERBOSE && ./echo " ok"
else
if [ -z "$VERBOSE" ]; then
./echo
./echo "$testcase"
fi
rc=1
fi
}
+4 -24
View File
@@ -1,31 +1,10 @@
./echo "headers"
. tests/functions.sh
title "headers"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
S=`./echo -n "$1" '..................................' | ./cols 34`
./echo -n " $S "
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo "ok"
else
./echo "FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'single #' '#' '<p>#</p>'
try 'empty ETX' '##' '<h1>#</h1>'
try 'single-char ETX (##W)' '##W' '<h2>W</h2>'
@@ -43,4 +22,5 @@ try 'SETEXT with trailing whitespace' \
'hello
===== ' '<h1>hello</h1>'
summary $0
exit $rc
+4 -22
View File
@@ -1,29 +1,10 @@
./echo "html blocks"
. tests/functions.sh
title "html blocks"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'self-closing block tags (hr)' \
'<hr>
@@ -109,4 +90,5 @@ so is this</div>'
try 'unfinished tags' '<foo bar' '<p>&lt;foo bar</p>'
summary $0
exit $rc
+4 -23
View File
@@ -1,30 +1,10 @@
./echo "embedded links"
. tests/functions.sh
title "embedded links"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'url contains &' '[hehehe](u&rl)' '<p><a href="u&amp;rl">hehehe</a></p>'
try 'url contains +' '[hehehe](u+rl)' '<p><a href="u+rl">hehehe</a></p>'
try 'url contains "' '[hehehe](u"rl)' '<p><a href="u%22rl">hehehe</a></p>'
@@ -121,4 +101,5 @@ try '[text] (text) not a link' \
'[test] (me)' \
'<p>[test] (me)</p>'
summary $0
exit $rc
+4 -22
View File
@@ -1,29 +1,10 @@
./echo "embedded images"
. tests/functions.sh
title "embedded images"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'image with size extension' \
'![picture](pic =200x200)' \
'<p><img src="pic" height="200" width="200" alt="picture" /></p>'
@@ -36,4 +17,5 @@ try 'image with width' \
'![picture](pic =200x)' \
'<p><img src="pic" width="200" alt="picture" /></p>'
summary $0
exit $rc
+3 -22
View File
@@ -1,29 +1,9 @@
./echo "lists"
. tests/functions.sh
title "lists"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'two separated items' \
' * A
@@ -175,4 +155,5 @@ if ./markdown -V | grep DL_TAG >/dev/null; then
fi
summary $0
exit $rc
+3 -22
View File
@@ -1,29 +1,9 @@
./echo "deeply nested lists"
. tests/functions.sh
title "deeply nested lists"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
LIST='
* top-level list ( list 1)
+ second-level list (list 2)
@@ -54,4 +34,5 @@ RSLT='<ul>
try 'thrice-nested lists' "$LIST" "$RSLT"
summary $0
exit $rc
+4 -23
View File
@@ -1,33 +1,14 @@
./echo "misc"
. tests/functions.sh
title "misc"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'single paragraph' 'AAA' '<p>AAA</p>'
try '< -> &lt;' '<' '<p>&lt;</p>'
try '`>` -> <code>&gt;</code>' '`>`' '<p><code>&gt;</code></p>'
try '`` ` `` -> <code>`</code>' '`` ` ``' '<p><code>`</code></p>'
summary $0
exit $rc
+4 -24
View File
@@ -1,31 +1,10 @@
./echo "pandoc headers"
. tests/functions.sh
title "pandoc headers"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
HEADER='% title
% author(s)
% date'
@@ -71,4 +50,5 @@ else
fi
summary $0
exit $rc
+4 -23
View File
@@ -1,30 +1,10 @@
./echo "paragraph blocking"
. tests/functions.sh
title "paragraph blocking"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'paragraph followed by code' \
'a
b' \
@@ -35,4 +15,5 @@ try 'paragraph followed by code' \
try 'single-line paragraph' 'a' '<p>a</p>'
summary $0
exit $rc
+4 -23
View File
@@ -1,31 +1,12 @@
./echo "paranoia"
. tests/functions.sh
title "paranoia"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try -fsafelink 'bogus url (-fsafelink)' '[test](bad:protocol)' '<p>[test](bad:protocol)</p>'
try -fnosafelink 'bogus url (-fnosafelink)' '[test](bad:protocol)' '<p><a href="bad:protocol">test</a></p>'
summary $0
exit $rc
+4 -22
View File
@@ -1,29 +1,10 @@
./echo "markup peculiarities"
. tests/functions.sh
title "markup peculiarities"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'list followed by header .......... ' \
"
- AAA
@@ -63,4 +44,5 @@ try -fnohtml 'markdown <br/> with -fnohtml' 'foo
is' '<p>foo<br/>
is</p>'
summary $0
exit $rc
+4 -23
View File
@@ -1,30 +1,10 @@
./echo "pseudo-protocols"
. tests/functions.sh
title "pseudo-protocols"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try '[](id:) links' '[foo](id:bar)' '<p><a id="bar">foo</a></p>'
try -fnoext '[](id:) links with -fnoext' '[foo](id:bar)' '<p>[foo](id:bar)</p>'
try '[](class:) links' '[foo](class:bar)' '<p><span class="bar">foo</span></p>'
@@ -32,4 +12,5 @@ try -fnoext '[](class:) links with -fnoext' '[foo](class:bar)' '<p>[foo](class:b
try '[](raw:) links' '[foo](raw:bar)' '<p>bar</p>'
try -fnoext '[](raw:) links with -fnoext' '[foo](raw:bar)' '<p>[foo](raw:bar)</p>'
summary $0
exit $rc
+4 -24
View File
@@ -1,31 +1,10 @@
./echo "bugs & misfeatures found during the Reddit rollout"
. tests/functions.sh
title "bugs & misfeatures found during the Reddit rollout"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
S=`./echo -n "$1" '..................................' | ./cols 34`
./echo -n " $S "
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo "ok"
else
./echo "FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'smiley faces?' '[8-9] <]:-( x ---> [4]' \
'<p>[8-9] &lt;]:&ndash;( x &mdash;&ndash;> [4]</p>'
@@ -44,4 +23,5 @@ try 'unescaping " " inside []()' \
bar)' \
'<p><a href="bar %0Abar">foo</a></p>'
summary $0
exit $rc
+4 -24
View File
@@ -1,34 +1,14 @@
./echo "footnotes inside reparse sections"
. tests/functions.sh
title "footnotes inside reparse sections"
rc=0
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'footnote inside [] section' \
'[![foo][]](bar)
[foo]: bar2' \
'<p><a href="bar"><img src="bar2" alt="foo" /></a></p>'
summary $0
exit $rc
+4 -24
View File
@@ -1,31 +1,10 @@
./echo "Bugs & misfeatures reported by Mike Schiraldi"
. tests/functions.sh
title "Bugs & misfeatures reported by Mike Schiraldi"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
S=`./echo -n "$1" '..................................' | ./cols 34`
./echo -n " $S "
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo "ok"
else
./echo "FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try -fnohtml 'breaks with -fnohtml' 'foo
bar' '<p>foo<br/>
bar</p>'
@@ -101,4 +80,5 @@ try -fautolink 'security hole with \" in []()' \
'<p><a href="/" title="\&quot;=\&quot;\&quot;onmouseover='$Q'alert(String.fromCharCode(88,83,83))'$Q'">XSS</a></p>'
summary $0
exit $rc
+4 -24
View File
@@ -1,31 +1,10 @@
./echo "smarty pants"
. tests/functions.sh
title "smarty pants"
rc=0
MARKDOWN_FLAGS=0x0; export MARKDOWN_FLAGS
try() {
unset FLAGS
case "$1" in
-*) FLAGS="$1"
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try '(c) -> &copy;' '(c)' '<p>&copy;</p>'
try '(r) -> &reg;' '(r)' '<p>&reg;</p>'
try '(tm) -> &trade;' '(tm)' '<p>&trade;</p>'
@@ -47,4 +26,5 @@ if ./markdown -V | grep SUPERSCRIPT >/dev/null; then
try -frelax 'A^B in link title' '[link](here "A^B")' '<p><a href="here" title="A^B">link</a></p>'
fi
summary $0
exit $rc
+4 -23
View File
@@ -1,30 +1,10 @@
./echo "The snakepit of Markdown.pl compatability"
. tests/functions.sh
title "The snakepit of Markdown.pl compatability"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try '[](single quote) text (quote)' \
"[foo](http://Poe's law) will make this fail ('no, it won't!') here."\
'<p><a href="http://Poe" title="s law) will make this fail ('"'no, it won't!"'">foo</a> here.</p>'
@@ -42,4 +22,5 @@ try '<unfinished &<tags> (2)' \
try 'paragraph <br/> oddity' 'EOF ' '<p>EOF</p>'
summary $0
exit $rc
+6 -21
View File
@@ -1,32 +1,17 @@
./echo "styles"
. tests/functions.sh
title "styles"
rc=0
MARKDOWN_FLAGS=
./echo -n ' <style> blocks -- one line ....... '
count=`./echo '<style> ul {display:none;} </style>' | ./markdown|wc -c`
if [ $count -eq 1 ]; then
./echo "ok"
else
./echo "FAILED"
rc=1
fi
./echo -n ' <style> blocks -- multiline ...... '
try '<style blocks -- one line' '<style> ul {display:none;} </style>' ''
ASK='<style>
ul {display:none;}
</style>'
count=`./echo "$ASK" | ./markdown | wc -c`
if [ $count -eq 1 ]; then
./echo "ok"
else
./echo "FAILED"
rc=1
fi
try '<style> blocks -- multiline' "$ASK" ''
summary $0
exit $rc
+4 -23
View File
@@ -1,30 +1,10 @@
./echo "tables"
. tests/functions.sh
title "tables"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'single-column table' \
'|hello
|-----
@@ -183,4 +163,5 @@ try 'table headers only' \
</tbody>
</table>'
summary $0
exit $rc
+4 -22
View File
@@ -1,32 +1,13 @@
. tests/functions.sh
rc=0
unset MARKDOWN_FLAGS
unset MKD_TABSTOP
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
eval `./markdown -V | tr ' ' '\n' | grep TAB`
if [ "${TAB:-4}" -eq 8 ]; then
./echo "dealing with tabstop derangement"
title "dealing with tabstop derangement"
LIST='
* A
@@ -63,4 +44,5 @@ if [ "${TAB:-4}" -eq 8 ]; then
fi
summary $0
exit $rc
+4 -24
View File
@@ -1,31 +1,10 @@
./echo "table-of-contents support"
. tests/functions.sh
title "table-of-contents support"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try '-T -ftoc' 'table of contents' \
'#H1
hi' \
@@ -38,4 +17,5 @@ hi' \
<p>hi</p>'
summary $0
exit $rc
+4 -25
View File
@@ -1,32 +1,10 @@
./echo "xml output with MKD_CDATA"
. tests/functions.sh
title "xml output with MKD_CDATA"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
case "$2" in
-t*) Q=`./markdown $FLAGS "$2"` ;;
*) Q=`./echo "$2" | ./markdown $FLAGS` ;;
esac
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try -fcdata 'xml output from markdown()' 'hello,sailor' '&lt;p&gt;hello,sailor&lt;/p&gt;'
try -fcdata 'from mkd_generateline()' -t'"hello,sailor"' '&amp;ldquo;hello,sailor&amp;rdquo;'
try -fnocdata 'html output from markdown()' '"hello,sailor"' '<p>&ldquo;hello,sailor&rdquo;</p>'
@@ -36,4 +14,5 @@ try -fcdata 'xml output with multibyte utf-8' \
'tecnología y servicios más confiables' \
'&lt;p&gt;tecnología y servicios más confiables&lt;/p&gt;'
summary $0
exit $rc