#!@BASH@ set -xe -o pipefail export LC_ALL=C export BLOGC=@abs_top_builddir@/blogc TEMP="$(mktemp -d)" [[ -n "${TEMP}" ]] trap_func() { [[ -e "${TEMP}/output.txt" ]] && cat "${TEMP}/output.txt" [[ -n "${TEMP}" ]] && rm -rf "${TEMP}" } trap trap_func EXIT mkdir -p "${TEMP}"/proj{,/templates,/content/post} ### minimal settings, will produce no file cat > "${TEMP}/proj/blogcfile" <&1 ### default settings with some posts cat > "${TEMP}/proj/content/post/foo.txt" < "${TEMP}/proj/content/post/bar.txt" < "${TEMP}/proj/content/post/post${i}.txt" < "${TEMP}/proj/templates/main.tmpl" <> "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/index\\.html" "${TEMP}/output.txt" grep "_build/atom\\.xml" "${TEMP}/output.txt" grep "_build/page/1/index\\.html" "${TEMP}/output.txt" grep "_build/post/foo/index\\.html" "${TEMP}/output.txt" grep "_build/post/bar/index\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" cat > "${TEMP}/expected-index.html" < "${TEMP}/expected-atom.xml" < Lol's Website /atom.xml 2016-09-01T00:00:00Z Lol author@example.com WAT?! Bar /post/bar/index.html 2016-09-01T00:00:00Z 2016-09-01T00:00:00Z Lol author@example.com This is bar.

]]>
Foo /post/foo/index.html 2016-10-01T00:00:00Z 2016-10-01T00:00:00Z Lol author@example.com This is foo.

]]>
EOF diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml" cat > "${TEMP}/expected-post-foo.html" <This is foo.

EOF diff -uN "${TEMP}/proj/_build/post/foo/index.html" "${TEMP}/expected-post-foo.html" cat > "${TEMP}/expected-post-bar.html" <This is bar.

EOF diff -uN "${TEMP}/proj/_build/post/bar/index.html" "${TEMP}/expected-post-bar.html" rm -rf "${TEMP}/proj/_build" ### default settings with some posts, posts per page -1 cat > "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/index\\.html" "${TEMP}/output.txt" grep "_build/atom\\.xml" "${TEMP}/output.txt" grep "_build/post/post01/index\\.html" "${TEMP}/output.txt" grep "_build/post/post02/index\\.html" "${TEMP}/output.txt" grep "_build/post/post03/index\\.html" "${TEMP}/output.txt" grep "_build/post/post04/index\\.html" "${TEMP}/output.txt" grep "_build/post/post05/index\\.html" "${TEMP}/output.txt" grep "_build/post/post06/index\\.html" "${TEMP}/output.txt" grep "_build/post/post07/index\\.html" "${TEMP}/output.txt" grep "_build/post/post08/index\\.html" "${TEMP}/output.txt" grep "_build/post/post09/index\\.html" "${TEMP}/output.txt" grep "_build/post/post10/index\\.html" "${TEMP}/output.txt" grep "_build/post/post11/index\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" cat > "${TEMP}/expected-index.html" < "${TEMP}/expected-atom.xml" < Lol's Website /atom.xml 2016-09-11T00:00:00Z Lol author@example.com WAT?! Post 11 /post/post11/index.html 2016-09-11T00:00:00Z 2016-09-11T00:00:00Z Lol author@example.com This is Post 11.

]]>
Post 10 /post/post10/index.html 2016-09-10T00:00:00Z 2016-09-10T00:00:00Z Lol author@example.com This is Post 10.

]]>
Post 09 /post/post09/index.html 2016-09-09T00:00:00Z 2016-09-09T00:00:00Z Lol author@example.com This is Post 09.

]]>
Post 08 /post/post08/index.html 2016-09-08T00:00:00Z 2016-09-08T00:00:00Z Lol author@example.com This is Post 08.

]]>
Post 07 /post/post07/index.html 2016-09-07T00:00:00Z 2016-09-07T00:00:00Z Lol author@example.com This is Post 07.

]]>
Post 06 /post/post06/index.html 2016-09-06T00:00:00Z 2016-09-06T00:00:00Z Lol author@example.com This is Post 06.

]]>
Post 05 /post/post05/index.html 2016-09-05T00:00:00Z 2016-09-05T00:00:00Z Lol author@example.com This is Post 05.

]]>
Post 04 /post/post04/index.html 2016-09-04T00:00:00Z 2016-09-04T00:00:00Z Lol author@example.com This is Post 04.

]]>
Post 03 /post/post03/index.html 2016-09-03T00:00:00Z 2016-09-03T00:00:00Z Lol author@example.com This is Post 03.

]]>
Post 02 /post/post02/index.html 2016-09-02T00:00:00Z 2016-09-02T00:00:00Z Lol author@example.com This is Post 02.

]]>
Post 01 /post/post01/index.html 2016-09-01T00:00:00Z 2016-09-01T00:00:00Z Lol author@example.com This is Post 01.

]]>
EOF diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml" cat > "${TEMP}/expected-post-post01.html" <This is Post 01.

EOF diff -uN "${TEMP}/proj/_build/post/post01/index.html" "${TEMP}/expected-post-post01.html" cat > "${TEMP}/expected-post-post11.html" <This is Post 11.

EOF diff -uN "${TEMP}/proj/_build/post/post11/index.html" "${TEMP}/expected-post-post11.html" rm -rf "${TEMP}/proj/_build" ### default settings with some posts, custom atom template cat > "${TEMP}/proj/blogcfile" < "${TEMP}/proj/templates/atom.tmpl" < {{ SITE_TITLE }}{% ifdef FILTER_TAG %} - {{ FILTER_TAG }}{% endif %} {{ BASE_URL }}/atom/{% ifdef FILTER_TAG %}{{ FILTER_TAG }}/{% endif %} {{ DATE_FIRST_FORMATTED }} {{ AUTHOR_NAME }} {{ AUTHOR_EMAIL }} {{ SITE_TAGLINE }} {% block listing %} {{ TITLE }} {{ BASE_URL }}/post/{{ FILENAME }}/ {{ DATE_FORMATTED }} {{ DATE_FORMATTED }} {{ AUTHOR_NAME }} {{ AUTHOR_EMAIL }} {% endblock %} EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&1 | tee "${TEMP}/output.txt" grep "_build/index\\.html" "${TEMP}/output.txt" grep "_build/atom\\.xml" "${TEMP}/output.txt" grep "_build/post/post01/index\\.html" "${TEMP}/output.txt" grep "_build/post/post02/index\\.html" "${TEMP}/output.txt" grep "_build/post/post03/index\\.html" "${TEMP}/output.txt" grep "_build/post/post04/index\\.html" "${TEMP}/output.txt" grep "_build/post/post05/index\\.html" "${TEMP}/output.txt" grep "_build/post/post06/index\\.html" "${TEMP}/output.txt" grep "_build/post/post07/index\\.html" "${TEMP}/output.txt" grep "_build/post/post08/index\\.html" "${TEMP}/output.txt" grep "_build/post/post09/index\\.html" "${TEMP}/output.txt" grep "_build/post/post10/index\\.html" "${TEMP}/output.txt" grep "_build/post/post11/index\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" cat > "${TEMP}/expected-atom.xml" < Lol's Website /atom/ 2016-09-11T00:00:00Z Lol author@example.com WAT?! Post 11 /post/post11/ 2016-09-11T00:00:00Z 2016-09-11T00:00:00Z Lol author@example.com This is Post 11.

]]>
Post 10 /post/post10/ 2016-09-10T00:00:00Z 2016-09-10T00:00:00Z Lol author@example.com This is Post 10.

]]>
Post 09 /post/post09/ 2016-09-09T00:00:00Z 2016-09-09T00:00:00Z Lol author@example.com This is Post 09.

]]>
Post 08 /post/post08/ 2016-09-08T00:00:00Z 2016-09-08T00:00:00Z Lol author@example.com This is Post 08.

]]>
Post 07 /post/post07/ 2016-09-07T00:00:00Z 2016-09-07T00:00:00Z Lol author@example.com This is Post 07.

]]>
Post 06 /post/post06/ 2016-09-06T00:00:00Z 2016-09-06T00:00:00Z Lol author@example.com This is Post 06.

]]>
Post 05 /post/post05/ 2016-09-05T00:00:00Z 2016-09-05T00:00:00Z Lol author@example.com This is Post 05.

]]>
Post 04 /post/post04/ 2016-09-04T00:00:00Z 2016-09-04T00:00:00Z Lol author@example.com This is Post 04.

]]>
Post 03 /post/post03/ 2016-09-03T00:00:00Z 2016-09-03T00:00:00Z Lol author@example.com This is Post 03.

]]>
Post 02 /post/post02/ 2016-09-02T00:00:00Z 2016-09-02T00:00:00Z Lol author@example.com This is Post 02.

]]>
Post 01 /post/post01/ 2016-09-01T00:00:00Z 2016-09-01T00:00:00Z Lol author@example.com This is Post 01.

]]>
EOF diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml" rm -rf "${TEMP}/proj/_build" ### default settings with some posts, atom posts per page 0 cat > "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/post/post01/index\\.html" "${TEMP}/output.txt" grep "_build/post/post02/index\\.html" "${TEMP}/output.txt" grep "_build/post/post03/index\\.html" "${TEMP}/output.txt" grep "_build/post/post04/index\\.html" "${TEMP}/output.txt" grep "_build/post/post05/index\\.html" "${TEMP}/output.txt" grep "_build/post/post06/index\\.html" "${TEMP}/output.txt" grep "_build/post/post07/index\\.html" "${TEMP}/output.txt" grep "_build/post/post08/index\\.html" "${TEMP}/output.txt" grep "_build/post/post09/index\\.html" "${TEMP}/output.txt" grep "_build/post/post10/index\\.html" "${TEMP}/output.txt" grep "_build/post/post11/index\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" cat > "${TEMP}/expected-post-post01.html" <This is Post 01.

EOF diff -uN "${TEMP}/proj/_build/post/post01/index.html" "${TEMP}/expected-post-post01.html" cat > "${TEMP}/expected-post-post11.html" <This is Post 11.

EOF diff -uN "${TEMP}/proj/_build/post/post11/index.html" "${TEMP}/expected-post-post11.html" rm -rf "${TEMP}/proj/_build" ### default settings with some posts, order asc, listing_entry cat > "${TEMP}/proj/content/hue.txt" < "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/index\\.html" "${TEMP}/output.txt" grep "_build/atom\\.xml" "${TEMP}/output.txt" grep "_build/page/1/index\\.html" "${TEMP}/output.txt" grep "_build/post/foo/index\\.html" "${TEMP}/output.txt" grep "_build/post/bar/index\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" cat > "${TEMP}/expected-index.html" <This is hue.

Listing: Foo - Oct 01, 2016, 12:00 AM GMT Listing: Bar - Sep 01, 2016, 12:00 AM GMT EOF diff -uN "${TEMP}/proj/_build/index.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/page/1/index.html" "${TEMP}/expected-index.html" cat > "${TEMP}/expected-atom.xml" < Lol's Website /atom.xml 2016-10-01T00:00:00Z Lol author@example.com WAT?! Foo /post/foo/index.html 2016-10-01T00:00:00Z 2016-10-01T00:00:00Z Lol author@example.com This is foo.

]]>
Bar /post/bar/index.html 2016-09-01T00:00:00Z 2016-09-01T00:00:00Z Lol author@example.com This is bar.

]]>
EOF diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml" cat > "${TEMP}/expected-post-foo.html" <This is foo.

EOF diff -uN "${TEMP}/proj/_build/post/foo/index.html" "${TEMP}/expected-post-foo.html" cat > "${TEMP}/expected-post-bar.html" <This is bar.

EOF diff -uN "${TEMP}/proj/_build/post/bar/index.html" "${TEMP}/expected-post-bar.html" rm -rf "${TEMP}/proj/_build" ### default settings with some posts and tags, order asc, listing_entry cat > "${TEMP}/proj/content/post/baz.txt" <> "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/index\\.html" "${TEMP}/output.txt" grep "_build/atom\\.xml" "${TEMP}/output.txt" grep "_build/atom/tag1\\.xml" "${TEMP}/output.txt" grep "_build/atom/tag2\\.xml" "${TEMP}/output.txt" grep "_build/page/1/index\\.html" "${TEMP}/output.txt" grep "_build/post/foo/index\\.html" "${TEMP}/output.txt" grep "_build/post/bar/index\\.html" "${TEMP}/output.txt" grep "_build/post/baz/index\\.html" "${TEMP}/output.txt" grep "_build/tag/tag1/index\\.html" "${TEMP}/output.txt" grep "_build/tag/tag2/index\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" cat > "${TEMP}/expected-index.html" <This is hue.

Listing: Foo - Oct 01, 2016, 12:00 AM GMT Listing: Bar - Sep 01, 2016, 12:00 AM GMT Listing: Baz - Aug 01, 2016, 12:00 AM GMT EOF diff -uN "${TEMP}/proj/_build/index.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/page/1/index.html" "${TEMP}/expected-index.html" cat > "${TEMP}/expected-atom.xml" < Lol's Website /atom.xml 2016-10-01T00:00:00Z Lol author@example.com WAT?! Foo /post/foo/index.html 2016-10-01T00:00:00Z 2016-10-01T00:00:00Z Lol author@example.com This is foo.

]]>
Bar /post/bar/index.html 2016-09-01T00:00:00Z 2016-09-01T00:00:00Z Lol author@example.com This is bar.

]]>
Baz /post/baz/index.html 2016-08-01T00:00:00Z 2016-08-01T00:00:00Z Lol author@example.com This is baz.

]]>
EOF diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml" cat > "${TEMP}/expected-atom-tag1.xml" < Lol's Website - tag1 /atom/tag1.xml 2016-08-01T00:00:00Z Lol author@example.com WAT?! Baz /post/baz/index.html 2016-08-01T00:00:00Z 2016-08-01T00:00:00Z Lol author@example.com This is baz.

]]>
EOF diff -uN "${TEMP}/proj/_build/atom/tag1.xml" "${TEMP}/expected-atom-tag1.xml" cat > "${TEMP}/expected-atom-tag2.xml" < Lol's Website - tag2 /atom/tag2.xml 2016-08-01T00:00:00Z Lol author@example.com WAT?! Baz /post/baz/index.html 2016-08-01T00:00:00Z 2016-08-01T00:00:00Z Lol author@example.com This is baz.

]]>
EOF diff -uN "${TEMP}/proj/_build/atom/tag2.xml" "${TEMP}/expected-atom-tag2.xml" cat > "${TEMP}/expected-post-baz.html" <This is baz.

EOF diff -uN "${TEMP}/proj/_build/post/foo/index.html" "${TEMP}/expected-post-foo.html" diff -uN "${TEMP}/proj/_build/post/bar/index.html" "${TEMP}/expected-post-bar.html" diff -uN "${TEMP}/proj/_build/post/baz/index.html" "${TEMP}/expected-post-baz.html" cat > "${TEMP}/expected-tag1.html" <This is hue.

Listing: tag1 - Baz - Aug 01, 2016, 12:00 AM GMT EOF diff -uN "${TEMP}/proj/_build/tag/tag1/index.html" "${TEMP}/expected-tag1.html" cat > "${TEMP}/expected-tag2.html" <This is hue.

Listing: tag2 - Baz - Aug 01, 2016, 12:00 AM GMT EOF diff -uN "${TEMP}/proj/_build/tag/tag2/index.html" "${TEMP}/expected-tag2.html" rm -rf "${TEMP}/proj/_build" ### default settings with some posts, pages and tags, order asc cat > "${TEMP}/proj/content/page1.txt" < "${TEMP}/proj/content/page2.txt" <> "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/index\\.html" "${TEMP}/output.txt" grep "_build/atom\\.xml" "${TEMP}/output.txt" grep "_build/atom/tag1\\.xml" "${TEMP}/output.txt" grep "_build/atom/tag2\\.xml" "${TEMP}/output.txt" grep "_build/page/1/index\\.html" "${TEMP}/output.txt" grep "_build/post/foo/index\\.html" "${TEMP}/output.txt" grep "_build/post/bar/index\\.html" "${TEMP}/output.txt" grep "_build/post/baz/index\\.html" "${TEMP}/output.txt" grep "_build/tag/tag1/index\\.html" "${TEMP}/output.txt" grep "_build/tag/tag2/index\\.html" "${TEMP}/output.txt" grep "_build/page1/index\\.html" "${TEMP}/output.txt" grep "_build/page2/index\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" diff -uN "${TEMP}/proj/_build/index.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/page/1/index.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml" diff -uN "${TEMP}/proj/_build/atom/tag1.xml" "${TEMP}/expected-atom-tag1.xml" diff -uN "${TEMP}/proj/_build/atom/tag2.xml" "${TEMP}/expected-atom-tag2.xml" diff -uN "${TEMP}/proj/_build/post/foo/index.html" "${TEMP}/expected-post-foo.html" diff -uN "${TEMP}/proj/_build/post/bar/index.html" "${TEMP}/expected-post-bar.html" diff -uN "${TEMP}/proj/_build/post/baz/index.html" "${TEMP}/expected-post-baz.html" diff -uN "${TEMP}/proj/_build/tag/tag1/index.html" "${TEMP}/expected-tag1.html" diff -uN "${TEMP}/proj/_build/tag/tag2/index.html" "${TEMP}/expected-tag2.html" cat > "${TEMP}/expected-page1.html" <This is page 1.

EOF diff -uN "${TEMP}/proj/_build/page1/index.html" "${TEMP}/expected-page1.html" cat > "${TEMP}/expected-page2.html" <This is page 2.

EOF diff -uN "${TEMP}/proj/_build/page2/index.html" "${TEMP}/expected-page2.html" rm -rf "${TEMP}/proj" mkdir -p "${TEMP}"/proj{,/temp,/contents/poost} ### custom settings with some posts cat > "${TEMP}/proj/contents/poost/foo.blogc" < "${TEMP}/proj/contents/poost/bar.blogc" < "${TEMP}/proj/temp/main.html" < "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/posts\\.html" "${TEMP}/output.txt" grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" grep "_build/pagination/1\\.html" "${TEMP}/output.txt" grep "_build/pagination/2\\.html" "${TEMP}/output.txt" grep "_build/poost/foo\\.html" "${TEMP}/output.txt" grep "_build/poost/bar\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" cat > "${TEMP}/expected-index.html" < "${TEMP}/expected-page-2.html" < "${TEMP}/expected-atom.xml" < Lol's Website /atoom/index.xml 2016-10-01T00:00:00Z Lol author@example.com WAT?! Foo /poost/foo.html 2016-10-01T00:00:00Z 2016-10-01T00:00:00Z Lol author@example.com This is foo.

]]>
EOF diff -uN "${TEMP}/proj/_build/atoom/index.xml" "${TEMP}/expected-atom.xml" cat > "${TEMP}/expected-post-foo.html" <This is foo.

EOF diff -uN "${TEMP}/proj/_build/poost/foo.html" "${TEMP}/expected-post-foo.html" cat > "${TEMP}/expected-post-bar.html" <This is bar.

EOF diff -uN "${TEMP}/proj/_build/poost/bar.html" "${TEMP}/expected-post-bar.html" rm -rf "${TEMP}/proj/_build" ### custom settings with some posts and tags cat > "${TEMP}/proj/contents/poost/baz.blogc" <> "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/posts\\.html" "${TEMP}/output.txt" grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" grep "_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" grep "_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" grep "_build/pagination/1\\.html" "${TEMP}/output.txt" grep "_build/pagination/2\\.html" "${TEMP}/output.txt" grep "_build/pagination/3\\.html" "${TEMP}/output.txt" grep "_build/poost/foo\\.html" "${TEMP}/output.txt" grep "_build/poost/bar\\.html" "${TEMP}/output.txt" grep "_build/poost/baz\\.html" "${TEMP}/output.txt" grep "_build/taag/tag1\\.html" "${TEMP}/output.txt" grep "_build/taag/tag2\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" diff -uN "${TEMP}/proj/_build/posts.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/pagination/1.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/pagination/2.html" "${TEMP}/expected-page-2.html" cat > "${TEMP}/expected-page-3.html" < "${TEMP}/expected-atom-tag1.xml" < Lol's Website - tag1 /atoom/tag1/index.xml 2016-08-01T00:00:00Z Lol author@example.com WAT?! Baz /poost/baz.html 2016-08-01T00:00:00Z 2016-08-01T00:00:00Z Lol author@example.com This is baz.

]]>
EOF diff -uN "${TEMP}/proj/_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" cat > "${TEMP}/expected-atom-tag2.xml" < Lol's Website - tag2 /atoom/tag2/index.xml 2016-08-01T00:00:00Z Lol author@example.com WAT?! Baz /poost/baz.html 2016-08-01T00:00:00Z 2016-08-01T00:00:00Z Lol author@example.com This is baz.

]]>
EOF diff -uN "${TEMP}/proj/_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" cat > "${TEMP}/expected-post-baz.html" <This is baz.

EOF diff -uN "${TEMP}/proj/_build/poost/foo.html" "${TEMP}/expected-post-foo.html" diff -uN "${TEMP}/proj/_build/poost/bar.html" "${TEMP}/expected-post-bar.html" diff -uN "${TEMP}/proj/_build/poost/baz.html" "${TEMP}/expected-post-baz.html" cat > "${TEMP}/expected-tag1.html" < "${TEMP}/expected-tag2.html" < "${TEMP}/proj/contents/page1.blogc" < "${TEMP}/proj/contents/page2.blogc" <> "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/posts\\.html" "${TEMP}/output.txt" grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" grep "_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" grep "_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" grep "_build/pagination/1\\.html" "${TEMP}/output.txt" grep "_build/pagination/2\\.html" "${TEMP}/output.txt" grep "_build/pagination/3\\.html" "${TEMP}/output.txt" grep "_build/poost/foo\\.html" "${TEMP}/output.txt" grep "_build/poost/bar\\.html" "${TEMP}/output.txt" grep "_build/poost/baz\\.html" "${TEMP}/output.txt" grep "_build/taag/tag1\\.html" "${TEMP}/output.txt" grep "_build/taag/tag2\\.html" "${TEMP}/output.txt" grep "_build/page1\\.html" "${TEMP}/output.txt" grep "_build/page2\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" diff -uN "${TEMP}/proj/_build/posts.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/pagination/1.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/pagination/2.html" "${TEMP}/expected-page-2.html" diff -uN "${TEMP}/proj/_build/pagination/3.html" "${TEMP}/expected-page-3.html" diff -uN "${TEMP}/proj/_build/atoom/index.xml" "${TEMP}/expected-atom.xml" diff -uN "${TEMP}/proj/_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" diff -uN "${TEMP}/proj/_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" diff -uN "${TEMP}/proj/_build/poost/foo.html" "${TEMP}/expected-post-foo.html" diff -uN "${TEMP}/proj/_build/poost/bar.html" "${TEMP}/expected-post-bar.html" diff -uN "${TEMP}/proj/_build/poost/baz.html" "${TEMP}/expected-post-baz.html" diff -uN "${TEMP}/proj/_build/taag/tag1.html" "${TEMP}/expected-tag1.html" diff -uN "${TEMP}/proj/_build/taag/tag2.html" "${TEMP}/expected-tag2.html" cat > "${TEMP}/expected-page1.html" <This is page 1.

EOF diff -uN "${TEMP}/proj/_build/page1.html" "${TEMP}/expected-page1.html" cat > "${TEMP}/expected-page2.html" <This is page 2.

EOF diff -uN "${TEMP}/proj/_build/page2.html" "${TEMP}/expected-page2.html" rm -rf "${TEMP}/proj/_build" ### copy rule mkdir -p "${TEMP}"/proj/{a/b/c,d/e,f} echo bola > "${TEMP}/proj/a/b/c/foo" echo guda > "${TEMP}/proj/a/b/bar" echo chunda > "${TEMP}/proj/a/baz" echo lol > "${TEMP}/proj/d/e/fuu" echo hehe > "${TEMP}/proj/d/xd" echo FFFUUUUUU > "${TEMP}/proj/f/XDDDD" cat >> "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/posts\\.html" "${TEMP}/output.txt" grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" grep "_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" grep "_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" grep "_build/pagination/1\\.html" "${TEMP}/output.txt" grep "_build/pagination/2\\.html" "${TEMP}/output.txt" grep "_build/pagination/3\\.html" "${TEMP}/output.txt" grep "_build/poost/foo\\.html" "${TEMP}/output.txt" grep "_build/poost/bar\\.html" "${TEMP}/output.txt" grep "_build/poost/baz\\.html" "${TEMP}/output.txt" grep "_build/taag/tag1\\.html" "${TEMP}/output.txt" grep "_build/taag/tag2\\.html" "${TEMP}/output.txt" grep "_build/page1\\.html" "${TEMP}/output.txt" grep "_build/page2\\.html" "${TEMP}/output.txt" grep "_build/a/b/c/foo" "${TEMP}/output.txt" grep "_build/a/b/bar" "${TEMP}/output.txt" grep "_build/a/baz" "${TEMP}/output.txt" grep "_build/d/e/fuu" "${TEMP}/output.txt" grep "_build/d/xd" "${TEMP}/output.txt" grep "_build/f/XDDDD" "${TEMP}/output.txt" rm "${TEMP}/output.txt" test "$(cat "${TEMP}/proj/_build/a/b/c/foo")" = "bola" test "$(cat "${TEMP}/proj/_build/a/b/bar")" = "guda" test "$(cat "${TEMP}/proj/_build/a/baz")" = "chunda" test "$(cat "${TEMP}/proj/_build/d/e/fuu")" = "lol" test "$(cat "${TEMP}/proj/_build/d/xd")" = "hehe" test "$(cat "${TEMP}/proj/_build/f/XDDDD")" = "FFFUUUUUU" ### clean rule ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" clean 2>&1 | tee "${TEMP}/output.txt" grep "_build/posts\\.html" "${TEMP}/output.txt" grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" grep "_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" grep "_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" grep "_build/pagination/1\\.html" "${TEMP}/output.txt" grep "_build/pagination/2\\.html" "${TEMP}/output.txt" grep "_build/pagination/3\\.html" "${TEMP}/output.txt" grep "_build/poost/foo\\.html" "${TEMP}/output.txt" grep "_build/poost/bar\\.html" "${TEMP}/output.txt" grep "_build/poost/baz\\.html" "${TEMP}/output.txt" grep "_build/taag/tag1\\.html" "${TEMP}/output.txt" grep "_build/taag/tag2\\.html" "${TEMP}/output.txt" grep "_build/page1\\.html" "${TEMP}/output.txt" grep "_build/page2\\.html" "${TEMP}/output.txt" grep "_build/a/b/c/foo" "${TEMP}/output.txt" grep "_build/a/b/bar" "${TEMP}/output.txt" grep "_build/a/baz" "${TEMP}/output.txt" grep "_build/d/e/fuu" "${TEMP}/output.txt" grep "_build/d/xd" "${TEMP}/output.txt" grep "_build/f/XDDDD" "${TEMP}/output.txt" rm "${TEMP}/output.txt" [[ ! -d "${TEMP}/proj/_build" ]] export OUTPUT_DIR="${TEMP}/___blogc_build" ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&1 | tee "${TEMP}/output.txt" grep "___blogc_build/posts\\.html" "${TEMP}/output.txt" grep "___blogc_build/atoom/index\\.xml" "${TEMP}/output.txt" grep "___blogc_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" grep "___blogc_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" grep "___blogc_build/pagination/1\\.html" "${TEMP}/output.txt" grep "___blogc_build/pagination/2\\.html" "${TEMP}/output.txt" grep "___blogc_build/pagination/3\\.html" "${TEMP}/output.txt" grep "___blogc_build/poost/foo\\.html" "${TEMP}/output.txt" grep "___blogc_build/poost/bar\\.html" "${TEMP}/output.txt" grep "___blogc_build/poost/baz\\.html" "${TEMP}/output.txt" grep "___blogc_build/taag/tag1\\.html" "${TEMP}/output.txt" grep "___blogc_build/taag/tag2\\.html" "${TEMP}/output.txt" grep "___blogc_build/page1\\.html" "${TEMP}/output.txt" grep "___blogc_build/page2\\.html" "${TEMP}/output.txt" grep "___blogc_build/a/b/c/foo" "${TEMP}/output.txt" grep "___blogc_build/a/b/bar" "${TEMP}/output.txt" grep "___blogc_build/a/baz" "${TEMP}/output.txt" grep "___blogc_build/d/e/fuu" "${TEMP}/output.txt" grep "___blogc_build/d/xd" "${TEMP}/output.txt" grep "___blogc_build/f/XDDDD" "${TEMP}/output.txt" rm "${TEMP}/output.txt" ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" clean 2>&1 | tee "${TEMP}/output.txt" grep "___blogc_build/posts\\.html" "${TEMP}/output.txt" grep "___blogc_build/atoom/index\\.xml" "${TEMP}/output.txt" grep "___blogc_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" grep "___blogc_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" grep "___blogc_build/pagination/1\\.html" "${TEMP}/output.txt" grep "___blogc_build/pagination/2\\.html" "${TEMP}/output.txt" grep "___blogc_build/pagination/3\\.html" "${TEMP}/output.txt" grep "___blogc_build/poost/foo\\.html" "${TEMP}/output.txt" grep "___blogc_build/poost/bar\\.html" "${TEMP}/output.txt" grep "___blogc_build/poost/baz\\.html" "${TEMP}/output.txt" grep "___blogc_build/taag/tag1\\.html" "${TEMP}/output.txt" grep "___blogc_build/taag/tag2\\.html" "${TEMP}/output.txt" grep "___blogc_build/page1\\.html" "${TEMP}/output.txt" grep "___blogc_build/page2\\.html" "${TEMP}/output.txt" grep "___blogc_build/a/b/c/foo" "${TEMP}/output.txt" grep "___blogc_build/a/b/bar" "${TEMP}/output.txt" grep "___blogc_build/a/baz" "${TEMP}/output.txt" grep "___blogc_build/d/e/fuu" "${TEMP}/output.txt" grep "___blogc_build/d/xd" "${TEMP}/output.txt" grep "___blogc_build/f/XDDDD" "${TEMP}/output.txt" rm "${TEMP}/output.txt" [[ ! -d "${OUTPUT_DIR}" ]] unset OUTPUT_DIR ### atom_dump rule ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" atom_dump | tee "${TEMP}/atom.xml" cat > "${TEMP}/expected-atom-dump.xml" < {{ SITE_TITLE }}{% ifdef FILTER_TAG %} - {{ FILTER_TAG }}{% endif %} {{ BASE_URL }}/atoom{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}{% endif %}/index.xml {{ DATE_FIRST_FORMATTED }} {{ AUTHOR_NAME }} {{ AUTHOR_EMAIL }} {{ SITE_TAGLINE }} {% block listing %} {{ TITLE }} {{ BASE_URL }}/poost/{{ FILENAME }}.html {{ DATE_FORMATTED }} {{ DATE_FORMATTED }} {{ AUTHOR_NAME }} {{ AUTHOR_EMAIL }} {% endblock %} EOF diff -uN "${TEMP}/atom.xml" "${TEMP}/expected-atom-dump.xml" rm "${TEMP}/atom.xml" rm -rf "${TEMP}/proj" ############################################################################### ### empty prefixes with some posts mkdir -p "${TEMP}/proj/"{contents,temp} cat > "${TEMP}/proj/contents/foo.blogc" < "${TEMP}/proj/contents/bar.blogc" < "${TEMP}/proj/temp/main.html" < "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/index\\.html" "${TEMP}/output.txt" grep "_build/index\\.xml" "${TEMP}/output.txt" grep "_build/1/index\\.html" "${TEMP}/output.txt" grep "_build/2/index\\.html" "${TEMP}/output.txt" grep "_build/foo/index\\.html" "${TEMP}/output.txt" grep "_build/bar/index\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" cat > "${TEMP}/expected-index.html" < "${TEMP}/expected-page-2.html" < "${TEMP}/expected-atom.xml" < Lol's Website /index.xml 2016-10-01T00:00:00Z Lol author@example.com WAT?! Foo /foo/index.html 2016-10-01T00:00:00Z 2016-10-01T00:00:00Z Lol author@example.com This is foo.

]]>
EOF diff -uN "${TEMP}/proj/_build/index.xml" "${TEMP}/expected-atom.xml" cat > "${TEMP}/expected-post-foo.html" <This is foo.

EOF diff -uN "${TEMP}/proj/_build/foo/index.html" "${TEMP}/expected-post-foo.html" cat > "${TEMP}/expected-post-bar.html" <This is bar.

EOF diff -uN "${TEMP}/proj/_build/bar/index.html" "${TEMP}/expected-post-bar.html" rm -rf "${TEMP}/proj/_build" ### empty prefixes with some posts and tags, and different exts cat > "${TEMP}/proj/contents/baz.blogc" < "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/index\\.html" "${TEMP}/output.txt" grep "_build/index\\.xml" "${TEMP}/output.txt" grep "_build/tag1/index\\.xml" "${TEMP}/output.txt" grep "_build/tag2/index\\.xml" "${TEMP}/output.txt" grep "_build/1\\.html" "${TEMP}/output.txt" grep "_build/2\\.html" "${TEMP}/output.txt" grep "_build/3\\.html" "${TEMP}/output.txt" grep "_build/foo\\.html" "${TEMP}/output.txt" grep "_build/bar\\.html" "${TEMP}/output.txt" grep "_build/baz\\.html" "${TEMP}/output.txt" grep "_build/tag1\\.html" "${TEMP}/output.txt" grep "_build/tag2\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" diff -uN "${TEMP}/proj/_build/index.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/1.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/2.html" "${TEMP}/expected-page-2.html" cat > "${TEMP}/expected-page-3.html" < "${TEMP}/expected-atom.xml" < Lol's Website /index.xml 2016-10-01T00:00:00Z Lol author@example.com WAT?! Foo /foo.html 2016-10-01T00:00:00Z 2016-10-01T00:00:00Z Lol author@example.com This is foo.

]]>
EOF diff -uN "${TEMP}/proj/_build/index.xml" "${TEMP}/expected-atom.xml" cat > "${TEMP}/expected-atom-tag1.xml" < Lol's Website - tag1 /tag1/index.xml 2016-08-01T00:00:00Z Lol author@example.com WAT?! Baz /baz.html 2016-08-01T00:00:00Z 2016-08-01T00:00:00Z Lol author@example.com This is baz.

]]>
EOF diff -uN "${TEMP}/proj/_build/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" cat > "${TEMP}/expected-atom-tag2.xml" < Lol's Website - tag2 /tag2/index.xml 2016-08-01T00:00:00Z Lol author@example.com WAT?! Baz /baz.html 2016-08-01T00:00:00Z 2016-08-01T00:00:00Z Lol author@example.com This is baz.

]]>
EOF diff -uN "${TEMP}/proj/_build/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" cat > "${TEMP}/expected-post-baz.html" <This is baz.

EOF diff -uN "${TEMP}/proj/_build/foo.html" "${TEMP}/expected-post-foo.html" diff -uN "${TEMP}/proj/_build/bar.html" "${TEMP}/expected-post-bar.html" diff -uN "${TEMP}/proj/_build/baz.html" "${TEMP}/expected-post-baz.html" cat > "${TEMP}/expected-tag1.html" < "${TEMP}/expected-tag2.html" < "${TEMP}/proj/contents/page1.blogc" < "${TEMP}/proj/contents/page2.blogc" <> "${TEMP}/proj/blogcfile" <&1 | tee "${TEMP}/output.txt" grep "_build/index\\.html" "${TEMP}/output.txt" grep "_build/index\\.xml" "${TEMP}/output.txt" grep "_build/tag1/index\\.xml" "${TEMP}/output.txt" grep "_build/tag2/index\\.xml" "${TEMP}/output.txt" grep "_build/1\\.html" "${TEMP}/output.txt" grep "_build/2\\.html" "${TEMP}/output.txt" grep "_build/3\\.html" "${TEMP}/output.txt" grep "_build/foo\\.html" "${TEMP}/output.txt" grep "_build/bar\\.html" "${TEMP}/output.txt" grep "_build/baz\\.html" "${TEMP}/output.txt" grep "_build/tag1\\.html" "${TEMP}/output.txt" grep "_build/tag2\\.html" "${TEMP}/output.txt" grep "_build/page1\\.html" "${TEMP}/output.txt" grep "_build/page2\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" diff -uN "${TEMP}/proj/_build/index.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/1.html" "${TEMP}/expected-index.html" diff -uN "${TEMP}/proj/_build/2.html" "${TEMP}/expected-page-2.html" diff -uN "${TEMP}/proj/_build/3.html" "${TEMP}/expected-page-3.html" diff -uN "${TEMP}/proj/_build/index.xml" "${TEMP}/expected-atom.xml" diff -uN "${TEMP}/proj/_build/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" diff -uN "${TEMP}/proj/_build/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" diff -uN "${TEMP}/proj/_build/foo.html" "${TEMP}/expected-post-foo.html" diff -uN "${TEMP}/proj/_build/bar.html" "${TEMP}/expected-post-bar.html" diff -uN "${TEMP}/proj/_build/baz.html" "${TEMP}/expected-post-baz.html" diff -uN "${TEMP}/proj/_build/tag1.html" "${TEMP}/expected-tag1.html" diff -uN "${TEMP}/proj/_build/tag2.html" "${TEMP}/expected-tag2.html" cat > "${TEMP}/expected-page1.html" <This is page 1.

EOF diff -uN "${TEMP}/proj/_build/page1.html" "${TEMP}/expected-page1.html" cat > "${TEMP}/expected-page2.html" <This is page 2.

EOF diff -uN "${TEMP}/proj/_build/page2.html" "${TEMP}/expected-page2.html" rm -rf "${TEMP}/proj/_build"