#!@BASH@ set -xe -o pipefail export LC_ALL=C TEMP="$(mktemp -d)" [[ -n "${TEMP}" ]] trap_func() { [[ -n "${TEMP}" ]] && rm -rf "${TEMP}" } trap trap_func EXIT ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc -v | grep blogc cat > "${TEMP}/post1.txt" < "${TEMP}/post2.txt" < "${TEMP}/post3.txt" < "${TEMP}/atom.tmpl" < {{ SITE_TITLE }} {{ BASE_URL }}/atom.xml {{ 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 cat > "${TEMP}/expected-output.xml" < Chunda's website /atom.xml 2010-01-01T11:11:11Z Chunda chunda@bola.com foo /post/post1/ 2010-01-01T11:11:11Z 2010-01-01T11:11:11Z Chunda chunda@bola.com f]]> bar /post/post2/ 2010-01-01T22:22:22Z 2010-01-01T22:22:22Z Chunda chunda@bola.com b]]> EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D AUTHOR_NAME=Chunda \ -D AUTHOR_EMAIL=chunda@bola.com \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%Y-%m-%dT%H:%M:%SZ" \ -t "${TEMP}/atom.tmpl" \ -o "${TEMP}/output.xml" \ -l \ "${TEMP}/post1.txt" "${TEMP}/post2.txt" diff -uN "${TEMP}/output.xml" "${TEMP}/expected-output.xml" echo -e "${TEMP}/post1.txt\n${TEMP}/post2.txt" | ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D AUTHOR_NAME=Chunda \ -D AUTHOR_EMAIL=chunda@bola.com \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%Y-%m-%dT%H:%M:%SZ" \ -t "${TEMP}/atom.tmpl" \ -o "${TEMP}/output2.xml" \ -l \ -i diff -uN "${TEMP}/output2.xml" "${TEMP}/expected-output.xml" ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D AUTHOR_NAME=Chunda \ -D AUTHOR_EMAIL=chunda@bola.com \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%Y-%m-%dT%H:%M:%SZ" \ -t "${TEMP}/atom.tmpl" \ -l \ "${TEMP}/post1.txt" "${TEMP}/post2.txt" > "${TEMP}/output3.xml" diff -uN "${TEMP}/output3.xml" "${TEMP}/expected-output.xml" echo -e "${TEMP}/post1.txt\n${TEMP}/post2.txt" | ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D AUTHOR_NAME=Chunda \ -D AUTHOR_EMAIL=chunda@bola.com \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%Y-%m-%dT%H:%M:%SZ" \ -t "${TEMP}/atom.tmpl" \ -l \ -i > "${TEMP}/output4.xml" diff -uN "${TEMP}/output4.xml" "${TEMP}/expected-output.xml" cat > "${TEMP}/main.tmpl" < {% ifdef FOO1 %}{{ FOO1 }} {% endif %}{% block entry %}{{ TITLE }}{% endblock %}{% block listing_once %}{{ SITE_TITLE }}{% endblock %}
{{ SITE_TITLE }}
{% block listing_entry %}{{ CONTENT }}{% endblock %}{% block listing_entry %}{{ CONTENT }}{% endblock %} {% block listing_once %}
Blog
    {% endblock %} {% block listing %}
  • {{ DATE_FORMATTED }}
    {{ TITLE }}
  • {% endblock %}{% block listing_empty %}vazio{% endblock %} {% block listing_once %}
{% endblock %} {% block entry %}
{% ifdef IS_POST %}
{% endif %}
{{ TITLE }}
{% ifdef IS_POST %}
{{ DATE_FORMATTED }}
{% endif %}
{{ CONTENT }} {% ifdef IS_POST %}

Back to posts

{% endif %}
{% endblock %} EOF cat > "${TEMP}/expected-output.html" < asd Chunda's website
Chunda's website
Blog
  • Jan 01, 2010, 11:11 AM GMT
    foo
  • Jan 01, 2010, 10:22 PM GMT
    bar
EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -D FOO1="asd" \ -t "${TEMP}/main.tmpl" \ -o "${TEMP}/output.html" \ -l \ "${TEMP}/post1.txt" "${TEMP}/post2.txt" diff -uN "${TEMP}/output.html" "${TEMP}/expected-output.html" echo -e "${TEMP}/post1.txt\n${TEMP}/post2.txt" | ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -D FOO1="asd" \ -t "${TEMP}/main.tmpl" \ -o "${TEMP}/output2.html" \ -l \ -i diff -uN "${TEMP}/output2.html" "${TEMP}/expected-output.html" ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -D FOO1="asd" \ -t "${TEMP}/main.tmpl" \ -l \ "${TEMP}/post1.txt" "${TEMP}/post2.txt" > "${TEMP}/output3.html" diff -uN "${TEMP}/output3.html" "${TEMP}/expected-output.html" echo -e "${TEMP}/post1.txt\n${TEMP}/post2.txt" | ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -D FOO1="asd" \ -t "${TEMP}/main.tmpl" \ -l \ -i > "${TEMP}/output4.html" diff -uN "${TEMP}/output4.html" "${TEMP}/expected-output.html" cat > "${TEMP}/expected-output2.html" < foo
Chunda's website
foo

foo?

EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -t "${TEMP}/main.tmpl" \ -o "${TEMP}/output5.html" \ "${TEMP}/post1.txt" diff -uN "${TEMP}/output5.html" "${TEMP}/expected-output2.html" echo -e "${TEMP}/post1.txt" | ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -t "${TEMP}/main.tmpl" \ -o "${TEMP}/output6.html" \ -i diff -uN "${TEMP}/output6.html" "${TEMP}/expected-output2.html" ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -t "${TEMP}/main.tmpl" \ "${TEMP}/post1.txt" > "${TEMP}/output7.html" diff -uN "${TEMP}/output7.html" "${TEMP}/expected-output2.html" echo -e "${TEMP}/post1.txt" | ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -t "${TEMP}/main.tmpl" \ -i > "${TEMP}/output8.html" diff -uN "${TEMP}/output8.html" "${TEMP}/expected-output2.html" cat > "${TEMP}/expected-output3.html" < Chunda's website
Chunda's website

bar?

Blog
  • Jan 01, 2010, 11:11 AM GMT
    foo
  • Jan 01, 2010, 10:22 PM GMT
    bar
EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -e "${TEMP}/post3.txt" \ -t "${TEMP}/main.tmpl" \ -o "${TEMP}/output9.html" \ -l \ "${TEMP}/post1.txt" "${TEMP}/post2.txt" diff -uN "${TEMP}/output9.html" "${TEMP}/expected-output3.html" echo -e "${TEMP}/post1.txt\n${TEMP}/post2.txt" | ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -e "${TEMP}/post3.txt" \ -t "${TEMP}/main.tmpl" \ -o "${TEMP}/output10.html" \ -l \ -i diff -uN "${TEMP}/output10.html" "${TEMP}/expected-output3.html" ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -e "${TEMP}/post3.txt" \ -t "${TEMP}/main.tmpl" \ -l \ "${TEMP}/post1.txt" "${TEMP}/post2.txt" > "${TEMP}/output11.html" diff -uN "${TEMP}/output11.html" "${TEMP}/expected-output3.html" echo -e "${TEMP}/post1.txt\n${TEMP}/post2.txt" | ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -e "${TEMP}/post3.txt" \ -t "${TEMP}/main.tmpl" \ -l \ -i > "${TEMP}/output12.html" diff -uN "${TEMP}/output12.html" "${TEMP}/expected-output3.html" cat > "${TEMP}/expected-output4.html" < Chunda's website
Chunda's website

foo?

Blog
  • Jan 01, 2010, 11:11 AM GMT
    foo
  • Jan 01, 2010, 10:22 PM GMT
    bar
EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -e "" \ -e "${TEMP}/post1.txt" \ -e "${TEMP}/post3.txt" \ -t "${TEMP}/main.tmpl" \ -o "${TEMP}/output13.html" \ -l \ "${TEMP}/post1.txt" "${TEMP}/post2.txt" diff -uN "${TEMP}/output13.html" "${TEMP}/expected-output4.html" cat > "${TEMP}/expected-output5.html" < Chunda's website
Chunda's website

foo?

bar?

Blog
  • Jan 01, 2010, 11:11 AM GMT
    foo
  • Jan 01, 2010, 10:22 PM GMT
    bar
EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -e "${TEMP}/post1.txt" \ -e "${TEMP}/post3.txt" \ -t "${TEMP}/main.tmpl" \ -o "${TEMP}/output14.html" \ -l \ "${TEMP}/post1.txt" "${TEMP}/post2.txt" diff -uN "${TEMP}/output14.html" "${TEMP}/expected-output5.html" cat > "${TEMP}/expected-output6.html" < Chunda's website
Chunda's website
Blog
    vazio
EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D BASE_DOMAIN=http://bola.com/ \ -D BASE_URL= \ -D SITE_TITLE="Chunda's website" \ -D DATE_FORMAT="%b %d, %Y, %I:%M %p GMT" \ -t "${TEMP}/main.tmpl" \ -o "${TEMP}/output15.html" \ -l diff -uN "${TEMP}/output15.html" "${TEMP}/expected-output6.html" echo "{% block listig %}foo{% endblock %}\n" > "${TEMP}/error.tmpl" ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -t "${TEMP}/error.tmpl" \ "${TEMP}/post1.txt" 2>&1 | tee "${TEMP}/output.txt" || true grep "blogc: error: template: Invalid block type" "${TEMP}/output.txt" ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D 123=a 2>&1 | tee "${TEMP}/output.txt" || true grep \ "blogc: error: invalid value for -D (first character in configuration key must be uppercase): 123" \ "${TEMP}/output.txt" ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc \ -D A1-3=a 2>&1 | tee "${TEMP}/output.txt" || true grep \ "blogc: error: invalid value for -D (configuration key must be uppercase with '_' and digits after first character): A1-3" \ "${TEMP}/output.txt"