From: Christian Heller Date: Sat, 19 Nov 2016 22:09:54 +0000 (+0100) Subject: Add feed.xml test. X-Git-Url: https://plomlompom.com/repos/bar%20baz.html?a=commitdiff_plain;h=96f44e7bae3b155434846d7a38721d3194b4f8a2;p=redo-blog Add feed.xml test. --- diff --git a/test.sh b/test.sh index 5a0284d..cf6e60c 100755 --- a/test.sh +++ b/test.sh @@ -11,6 +11,19 @@ else fi } +diff_test() +{ + generated_file="$1" + expected_file="$2" + printf "== %s diff test ==\n" "$generated_file" + diff "$expected_file" "$generated_file" + if [ "$?" = "0" ]; then + echo "== test SUCCESS ==" + else + echo "== test FAILURE ==" + fi +} + rm -rf test/test_dir ./add_dir.sh test/test_dir cp test/test_files/test.md test/test_dir/ @@ -26,12 +39,15 @@ for file in test/test_files/*.html test/test_files/*.meta; do echo "$file" | grep -q "\.html$"; then uuid_test "${cmp_file%.html}.uuid" fi - printf "== %s diff test ==\n" "$cmp_file" - diff "$file" "$cmp_file" - if [ "$?" = "0" ]; then - echo "== test SUCCESS ==" - else - echo "== test FAILURE ==" - fi + diff_test "$file" "$cmp_file" done uuid_test "test/test_dir/uuid.meta" +original_file="test/test_dir/feed.xml" +generated_file="$original_file".ignoring +expected_file="test/test_files/feed.xml.ignoring" +cat "$original_file" | \ + sed 's/>[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}ZIGNOREurn:uuid:[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}urn:uuid:IGNORE "$generated_file" +diff_test "$generated_file" "$expected_file" +rm "$generated_file" diff --git a/test/test_files/feed.xml.ignoring b/test/test_files/feed.xml.ignoring new file mode 100644 index 0000000..039a116 --- /dev/null +++ b/test/test_files/feed.xml.ignoring @@ -0,0 +1,44 @@ + + + + +Yet another blog +Joe Sixpack +urn:uuid:IGNORE +IGNORE + + +foo +urn:uuid:IGNORE +IGNORE +IGNORE + + +<p>bar</p> + + + + +a title with some nasty characters: &amp;&lt;&gt;&quot;' +urn:uuid:IGNORE +IGNORE +IGNORE + + +<p>this text contains some special characters: '&quot;&gt;&lt;&amp;</p> +<p>and more than one paragraph</p> + + + + +foo <em>bar</em> <strong>baz</strong> +urn:uuid:IGNORE +IGNORE +IGNORE + + +<p>bar</p> + + + + \ No newline at end of file