From 954d0f9dc63ada44926972a40f2a190ab4561b98 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Tue, 20 Mar 2018 23:07:26 +0100 Subject: make: fixed pagination, added tests --- tests/blogc-make/check_blogc_make.sh.in | 377 ++++++++++++++++++++++++++++++++ 1 file changed, 377 insertions(+) (limited to 'tests/blogc-make/check_blogc_make.sh.in') diff --git a/tests/blogc-make/check_blogc_make.sh.in b/tests/blogc-make/check_blogc_make.sh.in index d27c3c0..001241a 100755 --- a/tests/blogc-make/check_blogc_make.sh.in +++ b/tests/blogc-make/check_blogc_make.sh.in @@ -49,6 +49,15 @@ DATE: 2016-09-01 This is bar. EOF +for i in $(seq -f "%02g" 1 11); do + cat > "${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/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/ + 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.

+]]>
+
+ +
+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, atom posts per page 0 + +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 + + + + + Lol + author@example.com + + WAT?! + + +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, order asc cat > "${TEMP}/proj/blogcfile" <