summaryrefslogtreecommitdiffstats
path: root/tests/blogc-make
diff options
context:
space:
mode:
Diffstat (limited to 'tests/blogc-make')
-rw-r--r--tests/blogc-make/check_atom.c552
-rwxr-xr-xtests/blogc-make/check_blogc_make.sh.in2463
-rw-r--r--tests/blogc-make/check_exec.c318
-rw-r--r--tests/blogc-make/check_rules.c104
-rw-r--r--tests/blogc-make/check_settings.c394
-rw-r--r--tests/blogc-make/check_utils.c468
6 files changed, 0 insertions, 4299 deletions
diff --git a/tests/blogc-make/check_atom.c b/tests/blogc-make/check_atom.c
deleted file mode 100644
index e93bc76..0000000
--- a/tests/blogc-make/check_atom.c
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- * blogc: A blog compiler.
- * Copyright (C) 2014-2020 Rafael G. Martins <rafael@rafaelmartins.eng.br>
- *
- * This program can be distributed under the terms of the BSD License.
- * See the file LICENSE.
- */
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "../../src/blogc-make/atom.h"
-#include "../../src/blogc-make/settings.h"
-#include "../../src/common/file.h"
-#include "../../src/common/error.h"
-#include "../../src/common/utils.h"
-
-
-static void
-test_atom_generate_empty_file(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "atom_prefix", bc_strdup(""));
- bc_trie_insert(settings->settings, "atom_ext", bc_strdup(".xml"));
- bc_trie_insert(settings->settings, "post_prefix", bc_strdup(""));
- bc_trie_insert(settings->settings, "html_ext", bc_strdup(".html"));
-
- char *cmp = bm_atom_generate(settings);
-
- assert_non_null(cmp);
-
- assert_string_equal(cmp,
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
- "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n"
- " <title type=\"text\">{{ SITE_TITLE }}{% ifdef FILTER_TAG %} - "
- "{{ FILTER_TAG }}{% endif %}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}"
- "{% else %}/index{% endif %}.xml</id>\n"
- " <updated>{{ DATE_FIRST_FORMATTED }}</updated>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/\" />\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}{% ifdef FILTER_TAG %}"
- "/{{ FILTER_TAG }}{% else %}/index{% endif %}.xml\" rel=\"self\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <subtitle type=\"text\">{{ SITE_TAGLINE }}</subtitle>\n"
- " {%- block listing %}\n"
- " <entry>\n"
- " <title type=\"text\">{{ TITLE }}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/{{ FILENAME }}.html</id>\n"
- " <updated>{{ DATE_FORMATTED }}</updated>\n"
- " <published>{{ DATE_FORMATTED }}</published>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/{{ FILENAME }}.html\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <content type=\"html\"><![CDATA[{{ CONTENT }}]]></content>\n"
- " </entry>\n"
- " {%- endblock %}\n"
- "</feed>\n");
-
- free(cmp);
- bc_trie_free(settings->settings);
- free(settings);
-}
-
-
-static void
-test_atom_generate_empty_dir(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "atom_prefix", bc_strdup(""));
- bc_trie_insert(settings->settings, "atom_ext", bc_strdup("/index.xml"));
- bc_trie_insert(settings->settings, "post_prefix", bc_strdup(""));
- bc_trie_insert(settings->settings, "html_ext", bc_strdup("/index.html"));
-
- char *cmp = bm_atom_generate(settings);
-
- assert_non_null(cmp);
-
- assert_string_equal(cmp,
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
- "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n"
- " <title type=\"text\">{{ SITE_TITLE }}{% ifdef FILTER_TAG %} - "
- "{{ FILTER_TAG }}{% endif %}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}"
- "{% endif %}/index.xml</id>\n"
- " <updated>{{ DATE_FIRST_FORMATTED }}</updated>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/\" />\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}{% ifdef FILTER_TAG %}"
- "/{{ FILTER_TAG }}{% endif %}/index.xml\" rel=\"self\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <subtitle type=\"text\">{{ SITE_TAGLINE }}</subtitle>\n"
- " {%- block listing %}\n"
- " <entry>\n"
- " <title type=\"text\">{{ TITLE }}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/{{ FILENAME }}/index.html</id>\n"
- " <updated>{{ DATE_FORMATTED }}</updated>\n"
- " <published>{{ DATE_FORMATTED }}</published>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/{{ FILENAME }}/index.html\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <content type=\"html\"><![CDATA[{{ CONTENT }}]]></content>\n"
- " </entry>\n"
- " {%- endblock %}\n"
- "</feed>\n");
-
- free(cmp);
- bc_trie_free(settings->settings);
- free(settings);
-}
-
-
-static void
-test_atom_generate_file(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "atom_prefix", bc_strdup("atom"));
- bc_trie_insert(settings->settings, "atom_ext", bc_strdup(".xml"));
- bc_trie_insert(settings->settings, "post_prefix", bc_strdup("post"));
- bc_trie_insert(settings->settings, "html_ext", bc_strdup(".html"));
-
- char *cmp = bm_atom_generate(settings);
-
- assert_non_null(cmp);
-
- assert_string_equal(cmp,
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
- "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n"
- " <title type=\"text\">{{ SITE_TITLE }}{% ifdef FILTER_TAG %} - "
- "{{ FILTER_TAG }}{% endif %}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/atom{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}"
- "{% endif %}.xml</id>\n"
- " <updated>{{ DATE_FIRST_FORMATTED }}</updated>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/\" />\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/atom{% ifdef FILTER_TAG %}"
- "/{{ FILTER_TAG }}{% endif %}.xml\" rel=\"self\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <subtitle type=\"text\">{{ SITE_TAGLINE }}</subtitle>\n"
- " {%- block listing %}\n"
- " <entry>\n"
- " <title type=\"text\">{{ TITLE }}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/post/{{ FILENAME }}.html</id>\n"
- " <updated>{{ DATE_FORMATTED }}</updated>\n"
- " <published>{{ DATE_FORMATTED }}</published>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/post/{{ FILENAME }}.html\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <content type=\"html\"><![CDATA[{{ CONTENT }}]]></content>\n"
- " </entry>\n"
- " {%- endblock %}\n"
- "</feed>\n");
-
- free(cmp);
- bc_trie_free(settings->settings);
- free(settings);
-}
-
-
-static void
-test_atom_generate_dir(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "atom_prefix", bc_strdup("atom"));
- bc_trie_insert(settings->settings, "atom_ext", bc_strdup("/index.xml"));
- bc_trie_insert(settings->settings, "post_prefix", bc_strdup("post"));
- bc_trie_insert(settings->settings, "html_ext", bc_strdup("/index.html"));
-
- char *cmp = bm_atom_generate(settings);
-
- assert_non_null(cmp);
-
- assert_string_equal(cmp,
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
- "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n"
- " <title type=\"text\">{{ SITE_TITLE }}{% ifdef FILTER_TAG %} - "
- "{{ FILTER_TAG }}{% endif %}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/atom{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}"
- "{% endif %}/index.xml</id>\n"
- " <updated>{{ DATE_FIRST_FORMATTED }}</updated>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/\" />\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/atom{% ifdef FILTER_TAG %}"
- "/{{ FILTER_TAG }}{% endif %}/index.xml\" rel=\"self\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <subtitle type=\"text\">{{ SITE_TAGLINE }}</subtitle>\n"
- " {%- block listing %}\n"
- " <entry>\n"
- " <title type=\"text\">{{ TITLE }}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/post/{{ FILENAME }}/index.html</id>\n"
- " <updated>{{ DATE_FORMATTED }}</updated>\n"
- " <published>{{ DATE_FORMATTED }}</published>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/post/{{ FILENAME }}/index.html\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <content type=\"html\"><![CDATA[{{ CONTENT }}]]></content>\n"
- " </entry>\n"
- " {%- endblock %}\n"
- "</feed>\n");
-
- free(cmp);
- bc_trie_free(settings->settings);
- free(settings);
-}
-
-
-static void
-test_atom_empty_file(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "atom_prefix", bc_strdup(""));
- bc_trie_insert(settings->settings, "atom_ext", bc_strdup(".xml"));
- bc_trie_insert(settings->settings, "post_prefix", bc_strdup(""));
- bc_trie_insert(settings->settings, "html_ext", bc_strdup(".html"));
-
- bc_error_t *err = NULL;
- char *rv = bm_atom_deploy(settings, &err);
-
- assert_non_null(rv);
- assert_null(err);
-
- size_t cmp_len;
- char *cmp = bc_file_get_contents(rv, true, &cmp_len, &err);
-
- assert_non_null(cmp);
- assert_null(err);
-
- assert_string_equal(cmp,
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
- "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n"
- " <title type=\"text\">{{ SITE_TITLE }}{% ifdef FILTER_TAG %} - "
- "{{ FILTER_TAG }}{% endif %}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}"
- "{% else %}/index{% endif %}.xml</id>\n"
- " <updated>{{ DATE_FIRST_FORMATTED }}</updated>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/\" />\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}{% ifdef FILTER_TAG %}"
- "/{{ FILTER_TAG }}{% else %}/index{% endif %}.xml\" rel=\"self\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <subtitle type=\"text\">{{ SITE_TAGLINE }}</subtitle>\n"
- " {%- block listing %}\n"
- " <entry>\n"
- " <title type=\"text\">{{ TITLE }}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/{{ FILENAME }}.html</id>\n"
- " <updated>{{ DATE_FORMATTED }}</updated>\n"
- " <published>{{ DATE_FORMATTED }}</published>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/{{ FILENAME }}.html\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <content type=\"html\"><![CDATA[{{ CONTENT }}]]></content>\n"
- " </entry>\n"
- " {%- endblock %}\n"
- "</feed>\n");
-
- free(cmp);
- bm_atom_destroy(rv);
- free(rv);
- bc_trie_free(settings->settings);
- free(settings);
-}
-
-
-static void
-test_atom_empty_dir(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "atom_prefix", bc_strdup(""));
- bc_trie_insert(settings->settings, "atom_ext", bc_strdup("/index.xml"));
- bc_trie_insert(settings->settings, "post_prefix", bc_strdup(""));
- bc_trie_insert(settings->settings, "html_ext", bc_strdup("/index.html"));
-
- bc_error_t *err = NULL;
- char *rv = bm_atom_deploy(settings, &err);
-
- assert_non_null(rv);
- assert_null(err);
-
- size_t cmp_len;
- char *cmp = bc_file_get_contents(rv, true, &cmp_len, &err);
-
- assert_non_null(cmp);
- assert_null(err);
-
- assert_string_equal(cmp,
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
- "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n"
- " <title type=\"text\">{{ SITE_TITLE }}{% ifdef FILTER_TAG %} - "
- "{{ FILTER_TAG }}{% endif %}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}"
- "{% endif %}/index.xml</id>\n"
- " <updated>{{ DATE_FIRST_FORMATTED }}</updated>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/\" />\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}{% ifdef FILTER_TAG %}"
- "/{{ FILTER_TAG }}{% endif %}/index.xml\" rel=\"self\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <subtitle type=\"text\">{{ SITE_TAGLINE }}</subtitle>\n"
- " {%- block listing %}\n"
- " <entry>\n"
- " <title type=\"text\">{{ TITLE }}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/{{ FILENAME }}/index.html</id>\n"
- " <updated>{{ DATE_FORMATTED }}</updated>\n"
- " <published>{{ DATE_FORMATTED }}</published>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/{{ FILENAME }}/index.html\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <content type=\"html\"><![CDATA[{{ CONTENT }}]]></content>\n"
- " </entry>\n"
- " {%- endblock %}\n"
- "</feed>\n");
-
- free(cmp);
- bm_atom_destroy(rv);
- free(rv);
- bc_trie_free(settings->settings);
- free(settings);
-}
-
-
-static void
-test_atom_file(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "atom_prefix", bc_strdup("atom"));
- bc_trie_insert(settings->settings, "atom_ext", bc_strdup(".xml"));
- bc_trie_insert(settings->settings, "post_prefix", bc_strdup("post"));
- bc_trie_insert(settings->settings, "html_ext", bc_strdup(".html"));
-
- bc_error_t *err = NULL;
- char *rv = bm_atom_deploy(settings, &err);
-
- assert_non_null(rv);
- assert_null(err);
-
- size_t cmp_len;
- char *cmp = bc_file_get_contents(rv, true, &cmp_len, &err);
-
- assert_non_null(cmp);
- assert_null(err);
-
- assert_string_equal(cmp,
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
- "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n"
- " <title type=\"text\">{{ SITE_TITLE }}{% ifdef FILTER_TAG %} - "
- "{{ FILTER_TAG }}{% endif %}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/atom{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}"
- "{% endif %}.xml</id>\n"
- " <updated>{{ DATE_FIRST_FORMATTED }}</updated>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/\" />\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/atom{% ifdef FILTER_TAG %}"
- "/{{ FILTER_TAG }}{% endif %}.xml\" rel=\"self\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <subtitle type=\"text\">{{ SITE_TAGLINE }}</subtitle>\n"
- " {%- block listing %}\n"
- " <entry>\n"
- " <title type=\"text\">{{ TITLE }}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/post/{{ FILENAME }}.html</id>\n"
- " <updated>{{ DATE_FORMATTED }}</updated>\n"
- " <published>{{ DATE_FORMATTED }}</published>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/post/{{ FILENAME }}.html\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <content type=\"html\"><![CDATA[{{ CONTENT }}]]></content>\n"
- " </entry>\n"
- " {%- endblock %}\n"
- "</feed>\n");
-
- free(cmp);
- bm_atom_destroy(rv);
- free(rv);
- bc_trie_free(settings->settings);
- free(settings);
-}
-
-
-static void
-test_atom_dir(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "atom_prefix", bc_strdup("atom"));
- bc_trie_insert(settings->settings, "atom_ext", bc_strdup("/index.xml"));
- bc_trie_insert(settings->settings, "post_prefix", bc_strdup("post"));
- bc_trie_insert(settings->settings, "html_ext", bc_strdup("/index.html"));
-
- bc_error_t *err = NULL;
- char *rv = bm_atom_deploy(settings, &err);
-
- assert_non_null(rv);
- assert_null(err);
-
- size_t cmp_len;
- char *cmp = bc_file_get_contents(rv, true, &cmp_len, &err);
-
- assert_non_null(cmp);
- assert_null(err);
-
- assert_string_equal(cmp,
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
- "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n"
- " <title type=\"text\">{{ SITE_TITLE }}{% ifdef FILTER_TAG %} - "
- "{{ FILTER_TAG }}{% endif %}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/atom{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}"
- "{% endif %}/index.xml</id>\n"
- " <updated>{{ DATE_FIRST_FORMATTED }}</updated>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/\" />\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/atom{% ifdef FILTER_TAG %}"
- "/{{ FILTER_TAG }}{% endif %}/index.xml\" rel=\"self\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <subtitle type=\"text\">{{ SITE_TAGLINE }}</subtitle>\n"
- " {%- block listing %}\n"
- " <entry>\n"
- " <title type=\"text\">{{ TITLE }}</title>\n"
- " <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/post/{{ FILENAME }}/index.html</id>\n"
- " <updated>{{ DATE_FORMATTED }}</updated>\n"
- " <published>{{ DATE_FORMATTED }}</published>\n"
- " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/post/{{ FILENAME }}/index.html\" />\n"
- " <author>\n"
- " <name>{{ AUTHOR_NAME }}</name>\n"
- " <email>{{ AUTHOR_EMAIL }}</email>\n"
- " </author>\n"
- " <content type=\"html\"><![CDATA[{{ CONTENT }}]]></content>\n"
- " </entry>\n"
- " {%- endblock %}\n"
- "</feed>\n");
-
- free(cmp);
- bm_atom_destroy(rv);
- free(rv);
- bc_trie_free(settings->settings);
- free(settings);
-}
-
-
-static void
-test_atom_legacy_entry_id_empty(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "atom_prefix", bc_strdup(""));
- bc_trie_insert(settings->settings, "atom_ext", bc_strdup(".xml"));
- bc_trie_insert(settings->settings, "post_prefix", bc_strdup(""));
- bc_trie_insert(settings->settings, "html_ext", bc_strdup(".html"));
- bc_trie_insert(settings->settings, "atom_legacy_entry_id", bc_strdup("1"));
-
- bc_error_t *err = NULL;
- char *rv = bm_atom_deploy(settings, &err);
-
- assert_null(rv);
- assert_non_null(err);
-
- assert_int_equal(err->type, BLOGC_MAKE_ERROR_ATOM);
- assert_string_equal(err->msg,
- "'atom_legacy_entry_id' setting is not supported anymore. see "
- "https://blogc.rgm.io/news/blogc-0.16.1/ for details");
-
- bc_error_free(err);
- bc_trie_free(settings->settings);
- free(settings);
-}
-
-
-static void
-test_atom_legacy_entry_id(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "atom_prefix", bc_strdup("atom"));
- bc_trie_insert(settings->settings, "atom_ext", bc_strdup(".xml"));
- bc_trie_insert(settings->settings, "post_prefix", bc_strdup("post"));
- bc_trie_insert(settings->settings, "html_ext", bc_strdup(".html"));
- bc_trie_insert(settings->settings, "atom_legacy_entry_id", bc_strdup("1"));
-
- bc_error_t *err = NULL;
- char *rv = bm_atom_deploy(settings, &err);
-
- assert_null(rv);
- assert_non_null(err);
-
- assert_int_equal(err->type, BLOGC_MAKE_ERROR_ATOM);
- assert_string_equal(err->msg,
- "'atom_legacy_entry_id' setting is not supported anymore. see "
- "https://blogc.rgm.io/news/blogc-0.16.1/ for details");
-
- bc_error_free(err);
- bc_trie_free(settings->settings);
- free(settings);
-}
-
-
-int
-main(void)
-{
- const struct CMUnitTest tests[] = {
- cmocka_unit_test(test_atom_generate_empty_file),
- cmocka_unit_test(test_atom_generate_empty_dir),
- cmocka_unit_test(test_atom_generate_file),
- cmocka_unit_test(test_atom_generate_dir),
- cmocka_unit_test(test_atom_empty_file),
- cmocka_unit_test(test_atom_empty_dir),
- cmocka_unit_test(test_atom_file),
- cmocka_unit_test(test_atom_dir),
- cmocka_unit_test(test_atom_legacy_entry_id_empty),
- cmocka_unit_test(test_atom_legacy_entry_id),
- };
- return cmocka_run_group_tests(tests, NULL, NULL);
-}
diff --git a/tests/blogc-make/check_blogc_make.sh.in b/tests/blogc-make/check_blogc_make.sh.in
deleted file mode 100755
index 73393d4..0000000
--- a/tests/blogc-make/check_blogc_make.sh.in
+++ /dev/null
@@ -1,2463 +0,0 @@
-#!@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" <<EOF
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-EOF
-
-${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&1
-
-
-### default settings with some posts
-
-cat > "${TEMP}/proj/content/post/foo.txt" <<EOF
-TITLE: Foo
-DATE: 2016-10-01
-TAGS: qwe
-----------------
-This is foo.
-EOF
-
-cat > "${TEMP}/proj/content/post/bar.txt" <<EOF
-TITLE: Bar
-DATE: 2016-09-01
-TAGS: qwe
-----------------
-This is bar.
-EOF
-
-for i in $(seq -f "%02g" 1 11); do
- cat > "${TEMP}/proj/content/post/post${i}.txt" <<EOF
-TITLE: Post ${i}
-DATE: 2016-09-${i}
-TAGS: asd
-----------------
-This is Post ${i}.
-EOF
-done
-
-cat > "${TEMP}/proj/templates/main.tmpl" <<EOF
-{% block listing_entry %}{{ CONTENT }}{% endblock %}{% block listing %}
-Listing: {% ifdef FILTER_TAG %}{{ FILTER_TAG }} - {% endif %}{{ TITLE }} - {{ DATE_FORMATTED }}
-{% endblock %}
-{% block entry %}
-{{ TITLE }}{% if MAKE_TYPE == "post" %} - {{ DATE_FORMATTED }}{% endif %}
-
-{{ CONTENT }}
-{% endblock %}
-EOF
-
-cat >> "${TEMP}/proj/blogcfile" <<EOF
-[posts]
-foo
-bar
-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/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/page/2/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" <<EOF
-
-Listing: Bar - Sep 01, 2016, 12:00 AM GMT
-
-Listing: Foo - Oct 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" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website</title>
- <id>http://example.org/atom.xml</id>
- <updated>2016-09-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atom.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Bar</title>
- <id>http://example.org/post/bar/index.html</id>
- <updated>2016-09-01T00:00:00Z</updated>
- <published>2016-09-01T00:00:00Z</published>
- <link href="http://example.org/post/bar/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is bar.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Foo</title>
- <id>http://example.org/post/foo/index.html</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <published>2016-10-01T00:00:00Z</published>
- <link href="http://example.org/post/foo/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is foo.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml"
-
-cat > "${TEMP}/expected-post-foo.html" <<EOF
-
-
-Foo - Oct 01, 2016, 12:00 AM GMT
-
-<p>This is foo.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/post/foo/index.html" "${TEMP}/expected-post-foo.html"
-
-cat > "${TEMP}/expected-post-bar.html" <<EOF
-
-
-Bar - Sep 01, 2016, 12:00 AM GMT
-
-<p>This is bar.</p>
-
-
-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" <<EOF
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-
-[settings]
-posts_per_page = -1
-atom_posts_per_page = -1
-
-[posts]
-post01
-post02
-post03
-post04
-post05
-post06
-post07
-post08
-post09
-post10
-post11
-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-index.html" <<EOF
-
-Listing: Post 11 - Sep 11, 2016, 12:00 AM GMT
-
-Listing: Post 10 - Sep 10, 2016, 12:00 AM GMT
-
-Listing: Post 09 - Sep 09, 2016, 12:00 AM GMT
-
-Listing: Post 08 - Sep 08, 2016, 12:00 AM GMT
-
-Listing: Post 07 - Sep 07, 2016, 12:00 AM GMT
-
-Listing: Post 06 - Sep 06, 2016, 12:00 AM GMT
-
-Listing: Post 05 - Sep 05, 2016, 12:00 AM GMT
-
-Listing: Post 04 - Sep 04, 2016, 12:00 AM GMT
-
-Listing: Post 03 - Sep 03, 2016, 12:00 AM GMT
-
-Listing: Post 02 - Sep 02, 2016, 12:00 AM GMT
-
-Listing: Post 01 - Sep 01, 2016, 12:00 AM GMT
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/index.html" "${TEMP}/expected-index.html"
-
-cat > "${TEMP}/expected-atom.xml" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website</title>
- <id>http://example.org/atom.xml</id>
- <updated>2016-09-11T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atom.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Post 11</title>
- <id>http://example.org/post/post11/index.html</id>
- <updated>2016-09-11T00:00:00Z</updated>
- <published>2016-09-11T00:00:00Z</published>
- <link href="http://example.org/post/post11/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 11.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 10</title>
- <id>http://example.org/post/post10/index.html</id>
- <updated>2016-09-10T00:00:00Z</updated>
- <published>2016-09-10T00:00:00Z</published>
- <link href="http://example.org/post/post10/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 10.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 09</title>
- <id>http://example.org/post/post09/index.html</id>
- <updated>2016-09-09T00:00:00Z</updated>
- <published>2016-09-09T00:00:00Z</published>
- <link href="http://example.org/post/post09/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 09.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 08</title>
- <id>http://example.org/post/post08/index.html</id>
- <updated>2016-09-08T00:00:00Z</updated>
- <published>2016-09-08T00:00:00Z</published>
- <link href="http://example.org/post/post08/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 08.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 07</title>
- <id>http://example.org/post/post07/index.html</id>
- <updated>2016-09-07T00:00:00Z</updated>
- <published>2016-09-07T00:00:00Z</published>
- <link href="http://example.org/post/post07/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 07.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 06</title>
- <id>http://example.org/post/post06/index.html</id>
- <updated>2016-09-06T00:00:00Z</updated>
- <published>2016-09-06T00:00:00Z</published>
- <link href="http://example.org/post/post06/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 06.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 05</title>
- <id>http://example.org/post/post05/index.html</id>
- <updated>2016-09-05T00:00:00Z</updated>
- <published>2016-09-05T00:00:00Z</published>
- <link href="http://example.org/post/post05/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 05.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 04</title>
- <id>http://example.org/post/post04/index.html</id>
- <updated>2016-09-04T00:00:00Z</updated>
- <published>2016-09-04T00:00:00Z</published>
- <link href="http://example.org/post/post04/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 04.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 03</title>
- <id>http://example.org/post/post03/index.html</id>
- <updated>2016-09-03T00:00:00Z</updated>
- <published>2016-09-03T00:00:00Z</published>
- <link href="http://example.org/post/post03/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 03.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 02</title>
- <id>http://example.org/post/post02/index.html</id>
- <updated>2016-09-02T00:00:00Z</updated>
- <published>2016-09-02T00:00:00Z</published>
- <link href="http://example.org/post/post02/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 02.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 01</title>
- <id>http://example.org/post/post01/index.html</id>
- <updated>2016-09-01T00:00:00Z</updated>
- <published>2016-09-01T00:00:00Z</published>
- <link href="http://example.org/post/post01/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 01.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml"
-
-cat > "${TEMP}/expected-post-post01.html" <<EOF
-
-
-Post 01 - Sep 01, 2016, 12:00 AM GMT
-
-<p>This is Post 01.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/post/post01/index.html" "${TEMP}/expected-post-post01.html"
-
-cat > "${TEMP}/expected-post-post11.html" <<EOF
-
-
-Post 11 - Sep 11, 2016, 12:00 AM GMT
-
-<p>This is Post 11.</p>
-
-
-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" <<EOF
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-
-[settings]
-posts_per_page = -1
-atom_posts_per_page = -1
-atom_template = atom.tmpl
-
-[posts]
-post01
-post02
-post03
-post04
-post05
-post06
-post07
-post08
-post09
-post10
-post11
-EOF
-
-cat > "${TEMP}/proj/templates/atom.tmpl" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">{{ SITE_TITLE }}{% ifdef FILTER_TAG %} - {{ FILTER_TAG }}{% endif %}</title>
- <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/atom/{% ifdef FILTER_TAG %}{{ FILTER_TAG }}/{% endif %}</id>
- <updated>{{ DATE_FIRST_FORMATTED }}</updated>
- <link href="{{ BASE_DOMAIN }}{{ BASE_URL }}/" />
- <link href="{{ BASE_DOMAIN }}{{ BASE_URL }}/atom/{% ifdef FILTER_TAG %}{{ FILTER_TAG }}/{% endif %}" rel="self" />
- <author>
- <name>{{ AUTHOR_NAME }}</name>
- <email>{{ AUTHOR_EMAIL }}</email>
- </author>
- <subtitle type="text">{{ SITE_TAGLINE }}</subtitle>
- {%- block listing %}
- <entry>
- <title type="text">{{ TITLE }}</title>
- <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/post/{{ FILENAME }}/</id>
- <updated>{{ DATE_FORMATTED }}</updated>
- <published>{{ DATE_FORMATTED }}</published>
- <link href="{{ BASE_DOMAIN }}{{ BASE_URL }}/post/{{ FILENAME }}/" />
- <author>
- <name>{{ AUTHOR_NAME }}</name>
- <email>{{ AUTHOR_EMAIL }}</email>
- </author>
- <content type="html"><![CDATA[{{ CONTENT }}]]></content>
- </entry>
- {%- endblock %}
-</feed>
-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" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website</title>
- <id>http://example.org/atom/</id>
- <updated>2016-09-11T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atom/" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Post 11</title>
- <id>http://example.org/post/post11/</id>
- <updated>2016-09-11T00:00:00Z</updated>
- <published>2016-09-11T00:00:00Z</published>
- <link href="http://example.org/post/post11/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 11.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 10</title>
- <id>http://example.org/post/post10/</id>
- <updated>2016-09-10T00:00:00Z</updated>
- <published>2016-09-10T00:00:00Z</published>
- <link href="http://example.org/post/post10/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 10.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 09</title>
- <id>http://example.org/post/post09/</id>
- <updated>2016-09-09T00:00:00Z</updated>
- <published>2016-09-09T00:00:00Z</published>
- <link href="http://example.org/post/post09/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 09.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 08</title>
- <id>http://example.org/post/post08/</id>
- <updated>2016-09-08T00:00:00Z</updated>
- <published>2016-09-08T00:00:00Z</published>
- <link href="http://example.org/post/post08/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 08.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 07</title>
- <id>http://example.org/post/post07/</id>
- <updated>2016-09-07T00:00:00Z</updated>
- <published>2016-09-07T00:00:00Z</published>
- <link href="http://example.org/post/post07/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 07.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 06</title>
- <id>http://example.org/post/post06/</id>
- <updated>2016-09-06T00:00:00Z</updated>
- <published>2016-09-06T00:00:00Z</published>
- <link href="http://example.org/post/post06/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 06.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 05</title>
- <id>http://example.org/post/post05/</id>
- <updated>2016-09-05T00:00:00Z</updated>
- <published>2016-09-05T00:00:00Z</published>
- <link href="http://example.org/post/post05/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 05.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 04</title>
- <id>http://example.org/post/post04/</id>
- <updated>2016-09-04T00:00:00Z</updated>
- <published>2016-09-04T00:00:00Z</published>
- <link href="http://example.org/post/post04/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 04.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 03</title>
- <id>http://example.org/post/post03/</id>
- <updated>2016-09-03T00:00:00Z</updated>
- <published>2016-09-03T00:00:00Z</published>
- <link href="http://example.org/post/post03/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 03.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 02</title>
- <id>http://example.org/post/post02/</id>
- <updated>2016-09-02T00:00:00Z</updated>
- <published>2016-09-02T00:00:00Z</published>
- <link href="http://example.org/post/post02/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 02.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Post 01</title>
- <id>http://example.org/post/post01/</id>
- <updated>2016-09-01T00:00:00Z</updated>
- <published>2016-09-01T00:00:00Z</published>
- <link href="http://example.org/post/post01/" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is Post 01.</p>
-]]></content>
- </entry>
-</feed>
-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" <<EOF
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-
-[settings]
-atom_posts_per_page = 0
-posts_per_page = 0
-
-[posts]
-post01
-post02
-post03
-post04
-post05
-post06
-post07
-post08
-post09
-post10
-post11
-EOF
-
-${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&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" <<EOF
-
-
-Post 01 - Sep 01, 2016, 12:00 AM GMT
-
-<p>This is Post 01.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/post/post01/index.html" "${TEMP}/expected-post-post01.html"
-
-cat > "${TEMP}/expected-post-post11.html" <<EOF
-
-
-Post 11 - Sep 11, 2016, 12:00 AM GMT
-
-<p>This is Post 11.</p>
-
-
-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 and tags pagination
-
-cat > "${TEMP}/proj/blogcfile" <<EOF
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-
-[settings]
-atom_posts_per_page = 0
-posts_per_page = 3
-
-[posts]
-foo
-bar
-post01
-post02
-post03
-post04
-post05
-post06
-post07
-post08
-post09
-post10
-post11
-
-[tags]
-qwe
-asd
-EOF
-
-${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&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"
-grep "_build/tag/asd/index\\.html" "${TEMP}/output.txt"
-grep "_build/tag/asd/page/1/index\\.html" "${TEMP}/output.txt"
-grep "_build/tag/asd/page/2/index\\.html" "${TEMP}/output.txt"
-grep "_build/tag/asd/page/3/index\\.html" "${TEMP}/output.txt"
-grep "_build/tag/asd/page/4/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/tag/asd/page/5/index\\.html" "${TEMP}/output.txt"
-grep "_build/tag/qwe/index\\.html" "${TEMP}/output.txt"
-grep "_build/tag/qwe/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/tag/qwe/page/2/index\\.html" "${TEMP}/output.txt"
-
-rm "${TEMP}/output.txt"
-
-cat > "${TEMP}/expected-tag-asd1.html" <<EOF
-
-Listing: asd - Post 11 - Sep 11, 2016, 12:00 AM GMT
-
-Listing: asd - Post 10 - Sep 10, 2016, 12:00 AM GMT
-
-Listing: asd - Post 09 - Sep 09, 2016, 12:00 AM GMT
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/tag/asd/index.html" "${TEMP}/expected-tag-asd1.html"
-diff -uN "${TEMP}/proj/_build/tag/asd/page/1/index.html" "${TEMP}/expected-tag-asd1.html"
-
-cat > "${TEMP}/expected-tag-asd2.html" <<EOF
-
-Listing: asd - Post 08 - Sep 08, 2016, 12:00 AM GMT
-
-Listing: asd - Post 07 - Sep 07, 2016, 12:00 AM GMT
-
-Listing: asd - Post 06 - Sep 06, 2016, 12:00 AM GMT
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/tag/asd/page/2/index.html" "${TEMP}/expected-tag-asd2.html"
-
-cat > "${TEMP}/expected-tag-asd3.html" <<EOF
-
-Listing: asd - Post 05 - Sep 05, 2016, 12:00 AM GMT
-
-Listing: asd - Post 04 - Sep 04, 2016, 12:00 AM GMT
-
-Listing: asd - Post 03 - Sep 03, 2016, 12:00 AM GMT
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/tag/asd/page/3/index.html" "${TEMP}/expected-tag-asd3.html"
-
-cat > "${TEMP}/expected-tag-asd4.html" <<EOF
-
-Listing: asd - Post 02 - Sep 02, 2016, 12:00 AM GMT
-
-Listing: asd - Post 01 - Sep 01, 2016, 12:00 AM GMT
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/tag/asd/page/4/index.html" "${TEMP}/expected-tag-asd4.html"
-
-cat > "${TEMP}/expected-tag-qwe1.html" <<EOF
-
-Listing: qwe - Bar - Sep 01, 2016, 12:00 AM GMT
-
-Listing: qwe - Foo - Oct 01, 2016, 12:00 AM GMT
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/tag/qwe/index.html" "${TEMP}/expected-tag-qwe1.html"
-diff -uN "${TEMP}/proj/_build/tag/qwe/page/1/index.html" "${TEMP}/expected-tag-qwe1.html"
-
-rm -rf "${TEMP}/proj/_build"
-
-
-### default settings with some posts, order asc, posts_sort
-
-cat > "${TEMP}/proj/blogcfile" <<EOF
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-
-[settings]
-html_order = asc
-atom_order = asc
-posts_sort = yes
-
-[posts]
-foo
-bar
-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/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/page/2/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" <<EOF
-
-Listing: Bar - Sep 01, 2016, 12:00 AM GMT
-
-Listing: Foo - Oct 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" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website</title>
- <id>http://example.org/atom.xml</id>
- <updated>2016-09-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atom.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Bar</title>
- <id>http://example.org/post/bar/index.html</id>
- <updated>2016-09-01T00:00:00Z</updated>
- <published>2016-09-01T00:00:00Z</published>
- <link href="http://example.org/post/bar/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is bar.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Foo</title>
- <id>http://example.org/post/foo/index.html</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <published>2016-10-01T00:00:00Z</published>
- <link href="http://example.org/post/foo/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is foo.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml"
-
-cat > "${TEMP}/expected-post-foo.html" <<EOF
-
-
-Foo - Oct 01, 2016, 12:00 AM GMT
-
-<p>This is foo.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/post/foo/index.html" "${TEMP}/expected-post-foo.html"
-
-cat > "${TEMP}/expected-post-bar.html" <<EOF
-
-
-Bar - Sep 01, 2016, 12:00 AM GMT
-
-<p>This is bar.</p>
-
-
-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, order desc, posts_sort
-
-cat > "${TEMP}/proj/blogcfile" <<EOF
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-
-[settings]
-posts_sort = yes
-
-[posts]
-foo
-bar
-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/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/page/2/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" <<EOF
-
-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" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website</title>
- <id>http://example.org/atom.xml</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atom.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Foo</title>
- <id>http://example.org/post/foo/index.html</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <published>2016-10-01T00:00:00Z</published>
- <link href="http://example.org/post/foo/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is foo.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Bar</title>
- <id>http://example.org/post/bar/index.html</id>
- <updated>2016-09-01T00:00:00Z</updated>
- <published>2016-09-01T00:00:00Z</published>
- <link href="http://example.org/post/bar/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is bar.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml"
-
-cat > "${TEMP}/expected-post-foo.html" <<EOF
-
-
-Foo - Oct 01, 2016, 12:00 AM GMT
-
-<p>This is foo.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/post/foo/index.html" "${TEMP}/expected-post-foo.html"
-
-cat > "${TEMP}/expected-post-bar.html" <<EOF
-
-
-Bar - Sep 01, 2016, 12:00 AM GMT
-
-<p>This is bar.</p>
-
-
-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, order asc, listing_entry
-
-cat > "${TEMP}/proj/content/hue.txt" <<EOF
-TITLE: Hue
-----------------
-This is hue.
-EOF
-
-cat > "${TEMP}/proj/blogcfile" <<EOF
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-
-[settings]
-html_order = ASC
-atom_order = ASC
-listing_entry = hue
-
-[posts]
-foo
-bar
-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/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/page/2/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" <<EOF
-<p>This is hue.</p>
-
-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" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website</title>
- <id>http://example.org/atom.xml</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atom.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Foo</title>
- <id>http://example.org/post/foo/index.html</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <published>2016-10-01T00:00:00Z</published>
- <link href="http://example.org/post/foo/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is foo.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Bar</title>
- <id>http://example.org/post/bar/index.html</id>
- <updated>2016-09-01T00:00:00Z</updated>
- <published>2016-09-01T00:00:00Z</published>
- <link href="http://example.org/post/bar/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is bar.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml"
-
-cat > "${TEMP}/expected-post-foo.html" <<EOF
-
-
-Foo - Oct 01, 2016, 12:00 AM GMT
-
-<p>This is foo.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/post/foo/index.html" "${TEMP}/expected-post-foo.html"
-
-cat > "${TEMP}/expected-post-bar.html" <<EOF
-
-
-Bar - Sep 01, 2016, 12:00 AM GMT
-
-<p>This is bar.</p>
-
-
-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" <<EOF
-TITLE: Baz
-DATE: 2016-08-01
-TAGS: tag1 tag2
-----------------
-This is baz.
-EOF
-
-cat >> "${TEMP}/proj/blogcfile" <<EOF
-baz
-[tags]
-tag1
-tag2
-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/atom/tag1\\.xml" "${TEMP}/output.txt"
-grep "_build/atom/tag2\\.xml" "${TEMP}/output.txt"
-grep "_build/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/page/2/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/tag1/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/tag/tag1/page/2/index\\.html" "${TEMP}/output.txt"
-grep "_build/tag/tag2/index\\.html" "${TEMP}/output.txt"
-grep "_build/tag/tag2/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/tag/tag2/page/2/index\\.html" "${TEMP}/output.txt"
-
-rm "${TEMP}/output.txt"
-
-cat > "${TEMP}/expected-index.html" <<EOF
-<p>This is hue.</p>
-
-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" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website</title>
- <id>http://example.org/atom.xml</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atom.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Foo</title>
- <id>http://example.org/post/foo/index.html</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <published>2016-10-01T00:00:00Z</published>
- <link href="http://example.org/post/foo/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is foo.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Bar</title>
- <id>http://example.org/post/bar/index.html</id>
- <updated>2016-09-01T00:00:00Z</updated>
- <published>2016-09-01T00:00:00Z</published>
- <link href="http://example.org/post/bar/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is bar.</p>
-]]></content>
- </entry>
- <entry>
- <title type="text">Baz</title>
- <id>http://example.org/post/baz/index.html</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <published>2016-08-01T00:00:00Z</published>
- <link href="http://example.org/post/baz/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is baz.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml"
-
-cat > "${TEMP}/expected-atom-tag1.xml" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website - tag1</title>
- <id>http://example.org/atom/tag1.xml</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atom/tag1.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Baz</title>
- <id>http://example.org/post/baz/index.html</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <published>2016-08-01T00:00:00Z</published>
- <link href="http://example.org/post/baz/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is baz.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atom/tag1.xml" "${TEMP}/expected-atom-tag1.xml"
-
-cat > "${TEMP}/expected-atom-tag2.xml" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website - tag2</title>
- <id>http://example.org/atom/tag2.xml</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atom/tag2.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Baz</title>
- <id>http://example.org/post/baz/index.html</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <published>2016-08-01T00:00:00Z</published>
- <link href="http://example.org/post/baz/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is baz.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atom/tag2.xml" "${TEMP}/expected-atom-tag2.xml"
-
-cat > "${TEMP}/expected-post-baz.html" <<EOF
-
-
-Baz - Aug 01, 2016, 12:00 AM GMT
-
-<p>This is baz.</p>
-
-
-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" <<EOF
-<p>This is hue.</p>
-
-Listing: tag1 - Baz - Aug 01, 2016, 12:00 AM GMT
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/tag/tag1/index.html" "${TEMP}/expected-tag1.html"
-diff -uN "${TEMP}/proj/_build/tag/tag1/page/1/index.html" "${TEMP}/expected-tag1.html"
-
-cat > "${TEMP}/expected-tag2.html" <<EOF
-<p>This is hue.</p>
-
-Listing: tag2 - Baz - Aug 01, 2016, 12:00 AM GMT
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/tag/tag2/index.html" "${TEMP}/expected-tag2.html"
-diff -uN "${TEMP}/proj/_build/tag/tag2/page/1/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" <<EOF
-TITLE: Page 1
--------------
-This is page 1.
-EOF
-
-cat > "${TEMP}/proj/content/page2.txt" <<EOF
-TITLE: Page 2
--------------
-This is page 2.
-EOF
-
-cat >> "${TEMP}/proj/blogcfile" <<EOF
-[pages]
-page1
-page2
-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/atom/tag1\\.xml" "${TEMP}/output.txt"
-grep "_build/atom/tag2\\.xml" "${TEMP}/output.txt"
-grep "_build/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/page/2/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/tag1/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/tag/tag1/page/2/index\\.html" "${TEMP}/output.txt"
-grep "_build/tag/tag2/index\\.html" "${TEMP}/output.txt"
-grep "_build/tag/tag2/page/1/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/tag/tag2/page/2/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/tag1/page/1/index.html" "${TEMP}/expected-tag1.html"
-diff -uN "${TEMP}/proj/_build/tag/tag2/index.html" "${TEMP}/expected-tag2.html"
-diff -uN "${TEMP}/proj/_build/tag/tag2/page/1/index.html" "${TEMP}/expected-tag2.html"
-
-cat > "${TEMP}/expected-page1.html" <<EOF
-
-
-Page 1
-
-<p>This is page 1.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/page1/index.html" "${TEMP}/expected-page1.html"
-
-cat > "${TEMP}/expected-page2.html" <<EOF
-
-
-Page 2
-
-<p>This is page 2.</p>
-
-
-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" <<EOF
-TITLE: Foo
-DATE: 2016-10-01
-----------------
-This is foo.
-EOF
-
-cat > "${TEMP}/proj/contents/poost/bar.blogc" <<EOF
-TITLE: Bar
-DATE: 2016-09-01
-----------------
-This is bar.
-EOF
-
-cat > "${TEMP}/proj/temp/main.html" <<EOF
-{% block listing %}
-Listing: {% ifdef FILTER_TAG %}{{ FILTER_TAG }} - {% endif %}{{ TITLE }} - {{ DATE_FORMATTED }}
-{% endblock %}
-{% block entry %}
-{{ TITLE }}{% if MAKE_TYPE == "post" %} - {{ DATE_FORMATTED }}{% endif %}
-
-{{ CONTENT }}
-{% endblock %}
-EOF
-
-cat > "${TEMP}/proj/blogcfile" <<EOF
-[settings]
-content_dir = contents
-template_dir = temp
-main_template = main.html
-source_ext = .blogc
-pagination_prefix = pagination
-posts_per_page = 1
-atom_posts_per_page = 1
-html_ext = .html
-index_prefix = posts
-post_prefix = poost
-tag_prefix = taag
-atom_prefix = atoom
-atom_ext = /index.xml
-date_format = %b %d, %Y
-locale = en_US.utf8
-html_order = ASC
-atom_order = ASC
-
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-
-[posts]
-foo
-bar
-EOF
-
-${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&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 -v "_build/pagination/3\\.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" <<EOF
-
-Listing: Foo - Oct 01, 2016
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/posts.html" "${TEMP}/expected-index.html"
-diff -uN "${TEMP}/proj/_build/pagination/1.html" "${TEMP}/expected-index.html"
-
-cat > "${TEMP}/expected-page-2.html" <<EOF
-
-Listing: Bar - Sep 01, 2016
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/pagination/2.html" "${TEMP}/expected-page-2.html"
-
-cat > "${TEMP}/expected-atom.xml" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website</title>
- <id>http://example.org/atoom/index.xml</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atoom/index.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Foo</title>
- <id>http://example.org/poost/foo.html</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <published>2016-10-01T00:00:00Z</published>
- <link href="http://example.org/poost/foo.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is foo.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atoom/index.xml" "${TEMP}/expected-atom.xml"
-
-cat > "${TEMP}/expected-post-foo.html" <<EOF
-
-
-Foo - Oct 01, 2016
-
-<p>This is foo.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/poost/foo.html" "${TEMP}/expected-post-foo.html"
-
-cat > "${TEMP}/expected-post-bar.html" <<EOF
-
-
-Bar - Sep 01, 2016
-
-<p>This is bar.</p>
-
-
-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" <<EOF
-TITLE: Baz
-DATE: 2016-08-01
-TAGS: tag1 tag2
-----------------
-This is baz.
-EOF
-
-cat >> "${TEMP}/proj/blogcfile" <<EOF
-baz
-[tags]
-tag1
-tag2
-EOF
-
-${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 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 -v "_build/pagination/4\\.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/tag1/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "_build/taag/tag1/pagination/2\\.html" "${TEMP}/output.txt"
-grep "_build/taag/tag2\\.html" "${TEMP}/output.txt"
-grep "_build/taag/tag2/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "_build/taag/tag2/pagination/2\\.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" <<EOF
-
-Listing: Baz - Aug 01, 2016
-
-
-EOF
-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"
-
-cat > "${TEMP}/expected-atom-tag1.xml" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website - tag1</title>
- <id>http://example.org/atoom/tag1/index.xml</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atoom/tag1/index.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Baz</title>
- <id>http://example.org/poost/baz.html</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <published>2016-08-01T00:00:00Z</published>
- <link href="http://example.org/poost/baz.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is baz.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml"
-
-cat > "${TEMP}/expected-atom-tag2.xml" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website - tag2</title>
- <id>http://example.org/atoom/tag2/index.xml</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/atoom/tag2/index.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Baz</title>
- <id>http://example.org/poost/baz.html</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <published>2016-08-01T00:00:00Z</published>
- <link href="http://example.org/poost/baz.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is baz.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml"
-
-cat > "${TEMP}/expected-post-baz.html" <<EOF
-
-
-Baz - Aug 01, 2016
-
-<p>This is baz.</p>
-
-
-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" <<EOF
-
-Listing: tag1 - Baz - Aug 01, 2016
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/taag/tag1.html" "${TEMP}/expected-tag1.html"
-diff -uN "${TEMP}/proj/_build/taag/tag1/pagination/1.html" "${TEMP}/expected-tag1.html"
-
-cat > "${TEMP}/expected-tag2.html" <<EOF
-
-Listing: tag2 - Baz - Aug 01, 2016
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/taag/tag2.html" "${TEMP}/expected-tag2.html"
-diff -uN "${TEMP}/proj/_build/taag/tag2/pagination/1.html" "${TEMP}/expected-tag2.html"
-
-rm -rf "${TEMP}/proj/_build"
-
-
-### custom settings with some posts, pages and tags
-
-cat > "${TEMP}/proj/contents/page1.blogc" <<EOF
-TITLE: Page 1
--------------
-This is page 1.
-EOF
-
-cat > "${TEMP}/proj/contents/page2.blogc" <<EOF
-TITLE: Page 2
--------------
-This is page 2.
-EOF
-
-cat >> "${TEMP}/proj/blogcfile" <<EOF
-[pages]
-page1
-page2
-EOF
-
-${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 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 -v "_build/pagination/4\\.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/tag1/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "_build/taag/tag1/pagination/2\\.html" "${TEMP}/output.txt"
-grep "_build/taag/tag2\\.html" "${TEMP}/output.txt"
-grep "_build/taag/tag2/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "_build/taag/tag2/pagination/2\\.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/tag1/pagination/1.html" "${TEMP}/expected-tag1.html"
-diff -uN "${TEMP}/proj/_build/taag/tag2.html" "${TEMP}/expected-tag2.html"
-diff -uN "${TEMP}/proj/_build/taag/tag2/pagination/1.html" "${TEMP}/expected-tag2.html"
-
-cat > "${TEMP}/expected-page1.html" <<EOF
-
-
-Page 1
-
-<p>This is page 1.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/page1.html" "${TEMP}/expected-page1.html"
-
-cat > "${TEMP}/expected-page2.html" <<EOF
-
-
-Page 2
-
-<p>This is page 2.</p>
-
-
-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" <<EOF
-[copy]
-a
-d/e/fuu
-d/xd
-f
-EOF
-
-${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 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 -v "_build/pagination/4\\.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/tag1/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "_build/taag/tag1/pagination/2\\.html" "${TEMP}/output.txt"
-grep "_build/taag/tag2\\.html" "${TEMP}/output.txt"
-grep "_build/taag/tag2/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "_build/taag/tag2/pagination/2\\.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 -v "_build/pagination/4\\.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/tag1/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "_build/taag/tag1/pagination/2\\.html" "${TEMP}/output.txt"
-grep "_build/taag/tag2\\.html" "${TEMP}/output.txt"
-grep "_build/taag/tag2/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "_build/taag/tag2/pagination/2\\.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 -v "___blogc_build/pagination/4\\.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/tag1/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "___blogc_build/taag/tag1/pagination/2\\.html" "${TEMP}/output.txt"
-grep "___blogc_build/taag/tag2\\.html" "${TEMP}/output.txt"
-grep "___blogc_build/taag/tag2/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "___blogc_build/taag/tag2/pagination/2\\.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 -v "___blogc_build/pagination/4\\.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/tag1/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "___blogc_build/taag/tag1/pagination/2\\.html" "${TEMP}/output.txt"
-grep "___blogc_build/taag/tag2\\.html" "${TEMP}/output.txt"
-grep "___blogc_build/taag/tag2/pagination/1\\.html" "${TEMP}/output.txt"
-grep -v "___blogc_build/taag/tag2/pagination/2\\.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" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">{{ SITE_TITLE }}{% ifdef FILTER_TAG %} - {{ FILTER_TAG }}{% endif %}</title>
- <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/atoom{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}{% endif %}/index.xml</id>
- <updated>{{ DATE_FIRST_FORMATTED }}</updated>
- <link href="{{ BASE_DOMAIN }}{{ BASE_URL }}/" />
- <link href="{{ BASE_DOMAIN }}{{ BASE_URL }}/atoom{% ifdef FILTER_TAG %}/{{ FILTER_TAG }}{% endif %}/index.xml" rel="self" />
- <author>
- <name>{{ AUTHOR_NAME }}</name>
- <email>{{ AUTHOR_EMAIL }}</email>
- </author>
- <subtitle type="text">{{ SITE_TAGLINE }}</subtitle>
- {%- block listing %}
- <entry>
- <title type="text">{{ TITLE }}</title>
- <id>{{ BASE_DOMAIN }}{{ BASE_URL }}/poost/{{ FILENAME }}.html</id>
- <updated>{{ DATE_FORMATTED }}</updated>
- <published>{{ DATE_FORMATTED }}</published>
- <link href="{{ BASE_DOMAIN }}{{ BASE_URL }}/poost/{{ FILENAME }}.html" />
- <author>
- <name>{{ AUTHOR_NAME }}</name>
- <email>{{ AUTHOR_EMAIL }}</email>
- </author>
- <content type="html"><![CDATA[{{ CONTENT }}]]></content>
- </entry>
- {%- endblock %}
-</feed>
-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" <<EOF
-TITLE: Foo
-DATE: 2016-10-01
-----------------
-This is foo.
-EOF
-
-cat > "${TEMP}/proj/contents/bar.blogc" <<EOF
-TITLE: Bar
-DATE: 2016-09-01
-----------------
-This is bar.
-EOF
-
-cat > "${TEMP}/proj/temp/main.html" <<EOF
-{% block listing %}
-Listing: {% ifdef FILTER_TAG %}{{ FILTER_TAG }} - {% endif %}{{ TITLE }} - {{ DATE_FORMATTED }}
-{% endblock %}
-{% block entry %}
-{{ TITLE }}{% if MAKE_TYPE == "post" %} - {{ DATE_FORMATTED }}{% endif %}
-
-{{ CONTENT }}
-{% endblock %}
-EOF
-
-cat > "${TEMP}/proj/blogcfile" <<EOF
-[settings]
-content_dir = contents
-template_dir = temp
-main_template = main.html
-source_ext = .blogc
-pagination_prefix =
-posts_per_page = 1
-atom_posts_per_page = 1
-html_ext = /index.html
-index_prefix =
-post_prefix =
-tag_prefix =
-atom_prefix =
-atom_ext = .xml
-date_format = %b %d, %Y
-locale = en_US.utf8
-html_order = ASC
-atom_order = ASC
-
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-
-[posts]
-foo
-bar
-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/index\\.xml" "${TEMP}/output.txt"
-grep "_build/1/index\\.html" "${TEMP}/output.txt"
-grep "_build/2/index\\.html" "${TEMP}/output.txt"
-grep -v "_build/3/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" <<EOF
-
-Listing: Foo - Oct 01, 2016
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/index.html" "${TEMP}/expected-index.html"
-diff -uN "${TEMP}/proj/_build/1/index.html" "${TEMP}/expected-index.html"
-
-cat > "${TEMP}/expected-page-2.html" <<EOF
-
-Listing: Bar - Sep 01, 2016
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/2/index.html" "${TEMP}/expected-page-2.html"
-
-cat > "${TEMP}/expected-atom.xml" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website</title>
- <id>http://example.org/index.xml</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/index.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Foo</title>
- <id>http://example.org/foo/index.html</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <published>2016-10-01T00:00:00Z</published>
- <link href="http://example.org/foo/index.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is foo.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/index.xml" "${TEMP}/expected-atom.xml"
-
-cat > "${TEMP}/expected-post-foo.html" <<EOF
-
-
-Foo - Oct 01, 2016
-
-<p>This is foo.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/foo/index.html" "${TEMP}/expected-post-foo.html"
-
-cat > "${TEMP}/expected-post-bar.html" <<EOF
-
-
-Bar - Sep 01, 2016
-
-<p>This is bar.</p>
-
-
-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" <<EOF
-TITLE: Baz
-DATE: 2016-08-01
-TAGS: tag1 tag2
-----------------
-This is baz.
-EOF
-
-cat > "${TEMP}/proj/blogcfile" <<EOF
-[settings]
-content_dir = contents
-template_dir = temp
-main_template = main.html
-source_ext = .blogc
-pagination_prefix =
-posts_per_page = 1
-atom_posts_per_page = 1
-html_ext = .html
-index_prefix =
-post_prefix =
-tag_prefix =
-atom_prefix =
-atom_ext = /index.xml
-date_format = %b %d, %Y
-locale = en_US.utf8
-html_order = ASC
-atom_order = ASC
-
-[global]
-AUTHOR_NAME = Lol
-AUTHOR_EMAIL = author@example.com
-SITE_TITLE = Lol's Website
-SITE_TAGLINE = WAT?!
-BASE_DOMAIN = http://example.org
-
-[posts]
-foo
-bar
-baz
-
-[tags]
-tag1
-tag2
-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/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 -v "_build/4\\.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/tag1/1\\.html" "${TEMP}/output.txt"
-grep -v "_build/tag1/2\\.html" "${TEMP}/output.txt"
-grep "_build/tag2\\.html" "${TEMP}/output.txt"
-grep "_build/tag2/1\\.html" "${TEMP}/output.txt"
-grep -v "_build/tag2/2\\.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" <<EOF
-
-Listing: Baz - Aug 01, 2016
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/3.html" "${TEMP}/expected-page-3.html"
-
-cat > "${TEMP}/expected-atom.xml" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website</title>
- <id>http://example.org/index.xml</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/index.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Foo</title>
- <id>http://example.org/foo.html</id>
- <updated>2016-10-01T00:00:00Z</updated>
- <published>2016-10-01T00:00:00Z</published>
- <link href="http://example.org/foo.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is foo.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/index.xml" "${TEMP}/expected-atom.xml"
-
-cat > "${TEMP}/expected-atom-tag1.xml" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website - tag1</title>
- <id>http://example.org/tag1/index.xml</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/tag1/index.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Baz</title>
- <id>http://example.org/baz.html</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <published>2016-08-01T00:00:00Z</published>
- <link href="http://example.org/baz.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is baz.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml"
-
-cat > "${TEMP}/expected-atom-tag2.xml" <<EOF
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Lol's Website - tag2</title>
- <id>http://example.org/tag2/index.xml</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <link href="http://example.org/" />
- <link href="http://example.org/tag2/index.xml" rel="self" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <subtitle type="text">WAT?!</subtitle>
- <entry>
- <title type="text">Baz</title>
- <id>http://example.org/baz.html</id>
- <updated>2016-08-01T00:00:00Z</updated>
- <published>2016-08-01T00:00:00Z</published>
- <link href="http://example.org/baz.html" />
- <author>
- <name>Lol</name>
- <email>author@example.com</email>
- </author>
- <content type="html"><![CDATA[<p>This is baz.</p>
-]]></content>
- </entry>
-</feed>
-EOF
-diff -uN "${TEMP}/proj/_build/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml"
-
-cat > "${TEMP}/expected-post-baz.html" <<EOF
-
-
-Baz - Aug 01, 2016
-
-<p>This is baz.</p>
-
-
-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" <<EOF
-
-Listing: tag1 - Baz - Aug 01, 2016
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/tag1.html" "${TEMP}/expected-tag1.html"
-
-cat > "${TEMP}/expected-tag2.html" <<EOF
-
-Listing: tag2 - Baz - Aug 01, 2016
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/tag2.html" "${TEMP}/expected-tag2.html"
-
-rm -rf "${TEMP}/proj/_build"
-
-
-### custom settings with some posts, pages and tags
-
-cat > "${TEMP}/proj/contents/page1.blogc" <<EOF
-TITLE: Page 1
--------------
-This is page 1.
-EOF
-
-cat > "${TEMP}/proj/contents/page2.blogc" <<EOF
-TITLE: Page 2
--------------
-This is page 2.
-EOF
-
-cat >> "${TEMP}/proj/blogcfile" <<EOF
-[pages]
-page1
-page2
-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/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 -v "_build/4\\.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" <<EOF
-
-
-Page 1
-
-<p>This is page 1.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/page1.html" "${TEMP}/expected-page1.html"
-
-cat > "${TEMP}/expected-page2.html" <<EOF
-
-
-Page 2
-
-<p>This is page 2.</p>
-
-
-EOF
-diff -uN "${TEMP}/proj/_build/page2.html" "${TEMP}/expected-page2.html"
-
-rm -rf "${TEMP}/proj/_build"
diff --git a/tests/blogc-make/check_exec.c b/tests/blogc-make/check_exec.c
deleted file mode 100644
index 6b15423..0000000
--- a/tests/blogc-make/check_exec.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * blogc: A blog compiler.
- * Copyright (C) 2014-2019 Rafael G. Martins <rafael@rafaelmartins.eng.br>
- *
- * This program can be distributed under the terms of the BSD License.
- * See the file LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "../../src/blogc-make/exec.h"
-#include "../../src/blogc-make/settings.h"
-#include "../../src/common/utils.h"
-
-
-int
-__wrap_access(const char *pathname, int mode)
-{
- assert_int_equal(mode, X_OK);
- assert_string_equal(pathname, mock_type(const char*));
- return mock_type(int);
-}
-
-
-static void
-test_find_binary(void **state)
-{
- unsetenv("BLOGC");
-
- char *bin = bm_exec_find_binary(NULL, "blogc", "BLOGC");
- assert_string_equal(bin, "blogc");
- free(bin);
-
- bin = bm_exec_find_binary("blogc-make", "blogc", "BLOGC");
- assert_string_equal(bin, "blogc");
- free(bin);
-
- will_return(__wrap_access, "../blogc");
- will_return(__wrap_access, 0);
- bin = bm_exec_find_binary("../blogc-make", "blogc", "BLOGC");
- assert_string_equal(bin, "'../blogc'");
- free(bin);
-
- will_return(__wrap_access, "/usr/bin/blogc");
- will_return(__wrap_access, 0);
- bin = bm_exec_find_binary("/usr/bin/blogc-make", "blogc", "BLOGC");
- assert_string_equal(bin, "'/usr/bin/blogc'");
- free(bin);
-
- will_return(__wrap_access, "../blogc");
- will_return(__wrap_access, 1);
- bin = bm_exec_find_binary("../blogc-make", "blogc", "BLOGC");
- assert_string_equal(bin, "blogc");
- free(bin);
-
- setenv("BLOGC", "/path/to/blogc", 1);
- bin = bm_exec_find_binary(NULL, "blogc", "BLOGC");
- assert_string_equal(bin, "'/path/to/blogc'");
- free(bin);
- unsetenv("BLOGC");
-}
-
-
-static void
-test_build_blogc_cmd_with_settings(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "locale", bc_strdup("en_US.utf8"));
- settings->global = bc_trie_new(free);
- bc_trie_insert(settings->global, "FOO", bc_strdup("BAR"));
- bc_trie_insert(settings->global, "BAR", bc_strdup("BAZ"));
- bc_trie_t *variables = bc_trie_new(free);
- bc_trie_insert(variables, "LOL", bc_strdup("HEHE"));
- bc_trie_t *local = bc_trie_new(free);
- bc_trie_insert(local, "ASD", bc_strdup("QWE"));
- settings->tags = NULL;
-
- char *rv = bm_exec_build_blogc_cmd("blogc", settings, variables, local, NULL,
- true, NULL, "main.tmpl", "foo.html", false, true);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D FOO='BAR' -D BAR='BAZ' -D LOL='HEHE' "
- "-D ASD='QWE' -l -t 'main.tmpl' -o 'foo.html' -i");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", settings, variables, local, NULL, true,
- "foo.txt", "main.tmpl", "foo.html", false, true);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D FOO='BAR' -D BAR='BAZ' -D LOL='HEHE' "
- "-D ASD='QWE' -l -e 'foo.txt' -t 'main.tmpl' -o 'foo.html' -i");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", settings, variables, NULL, NULL, false,
- NULL, NULL, NULL, false, false);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D FOO='BAR' -D BAR='BAZ' -D LOL='HEHE'");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", settings, NULL, NULL, NULL, false,
- NULL, NULL, NULL, false, false);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D FOO='BAR' -D BAR='BAZ'");
- free(rv);
-
- bc_trie_free(local);
- bc_trie_free(variables);
- bc_trie_free(settings->settings);
- bc_trie_free(settings->global);
- free(settings);
-}
-
-
-static void
-test_build_blogc_cmd_with_settings_and_dev(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "locale", bc_strdup("en_US.utf8"));
- settings->global = bc_trie_new(free);
- bc_trie_insert(settings->global, "FOO", bc_strdup("BAR"));
- bc_trie_insert(settings->global, "BAR", bc_strdup("BAZ"));
- bc_trie_t *variables = bc_trie_new(free);
- bc_trie_insert(variables, "LOL", bc_strdup("HEHE"));
- bc_trie_t *local = bc_trie_new(free);
- bc_trie_insert(local, "ASD", bc_strdup("QWE"));
- settings->tags = NULL;
-
- char *rv = bm_exec_build_blogc_cmd("blogc", settings, variables, local, NULL,
- true, NULL, "main.tmpl", "foo.html", true, true);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D FOO='BAR' -D BAR='BAZ' -D LOL='HEHE' "
- "-D ASD='QWE' -D MAKE_ENV_DEV=1 -D MAKE_ENV='dev' -l -t 'main.tmpl' "
- "-o 'foo.html' -i");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", settings, variables, local, NULL, true,
- "foo.txt", "main.tmpl", "foo.html", true, true);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D FOO='BAR' -D BAR='BAZ' -D LOL='HEHE' "
- "-D ASD='QWE' -D MAKE_ENV_DEV=1 -D MAKE_ENV='dev' -l -e 'foo.txt' "
- "-t 'main.tmpl' -o 'foo.html' -i");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", settings, variables, NULL, NULL, false,
- NULL, NULL, NULL, true, false);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D FOO='BAR' -D BAR='BAZ' -D LOL='HEHE' "
- "-D MAKE_ENV_DEV=1 -D MAKE_ENV='dev'");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", settings, NULL, NULL, NULL, false,
- NULL, NULL, NULL, true, false);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D FOO='BAR' -D BAR='BAZ' "
- "-D MAKE_ENV_DEV=1 -D MAKE_ENV='dev'");
- free(rv);
-
- bc_trie_free(local);
- bc_trie_free(variables);
- bc_trie_free(settings->settings);
- bc_trie_free(settings->global);
- free(settings);
-}
-
-
-static void
-test_build_blogc_cmd_with_settings_and_tags(void **state)
-{
- bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t));
- settings->settings = bc_trie_new(free);
- bc_trie_insert(settings->settings, "locale", bc_strdup("en_US.utf8"));
- settings->global = bc_trie_new(free);
- bc_trie_insert(settings->global, "FOO", bc_strdup("BAR"));
- bc_trie_insert(settings->global, "BAR", bc_strdup("BAZ"));
- bc_trie_t *variables = bc_trie_new(free);
- bc_trie_insert(variables, "LOL", bc_strdup("HEHE"));
- bc_trie_t *local = bc_trie_new(free);
- bc_trie_insert(local, "ASD", bc_strdup("QWE"));
- settings->tags = bc_str_split("asd foo bar", ' ', 0);
-
- char *rv = bm_exec_build_blogc_cmd("blogc", settings, variables, local, NULL,
- true, NULL, "main.tmpl", "foo.html", true, true);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D MAKE_TAGS='asd foo bar' -D FOO='BAR' "
- "-D BAR='BAZ' -D LOL='HEHE' -D ASD='QWE' -D MAKE_ENV_DEV=1 "
- "-D MAKE_ENV='dev' -l -t 'main.tmpl' -o 'foo.html' -i");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", settings, variables, local, NULL, true,
- "foo.txt", "main.tmpl", "foo.html", true, true);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D MAKE_TAGS='asd foo bar' -D FOO='BAR' "
- "-D BAR='BAZ' -D LOL='HEHE' -D ASD='QWE' -D MAKE_ENV_DEV=1 "
- "-D MAKE_ENV='dev' -l -e 'foo.txt' -t 'main.tmpl' -o 'foo.html' -i");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", settings, variables, NULL, NULL, false,
- NULL, NULL, NULL, true, false);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D MAKE_TAGS='asd foo bar' -D FOO='BAR' "
- "-D BAR='BAZ' -D LOL='HEHE' -D MAKE_ENV_DEV=1 -D MAKE_ENV='dev'");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", settings, NULL, NULL, NULL, false,
- NULL, NULL, NULL, true, false);
- assert_string_equal(rv,
- "LC_ALL='en_US.utf8' blogc -D MAKE_TAGS='asd foo bar' -D FOO='BAR' "
- "-D BAR='BAZ' -D MAKE_ENV_DEV=1 -D MAKE_ENV='dev'");
- free(rv);
-
- bc_trie_free(local);
- bc_trie_free(variables);
- bc_trie_free(settings->settings);
- bc_trie_free(settings->global);
- bc_strv_free(settings->tags);
- free(settings);
-}
-
-
-static void
-test_build_blogc_cmd_without_settings(void **state)
-{
- bc_trie_t *variables = bc_trie_new(free);
- bc_trie_insert(variables, "LOL", bc_strdup("HEHE"));
- bc_trie_t *local = bc_trie_new(free);
- bc_trie_insert(local, "ASD", bc_strdup("QWE"));
-
- char *rv = bm_exec_build_blogc_cmd("blogc", NULL, variables, local, NULL,
- true, NULL, "main.tmpl", "foo.html", false, true);
- assert_string_equal(rv,
- "blogc -D LOL='HEHE' -D ASD='QWE' -l -t 'main.tmpl' -o 'foo.html' -i");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", NULL, variables, local, NULL, true,
- "foo.txt", "main.tmpl", "foo.html", false, true);
- assert_string_equal(rv,
- "blogc -D LOL='HEHE' -D ASD='QWE' -l -e 'foo.txt' -t 'main.tmpl' "
- "-o 'foo.html' -i");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", NULL, variables, NULL, NULL, false,
- NULL, NULL, NULL, false, false);
- assert_string_equal(rv,
- "blogc -D LOL='HEHE'");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", NULL, NULL, NULL, NULL, false, NULL,
- NULL, NULL, false, false);
- assert_string_equal(rv,
- "blogc");
- free(rv);
-
- bc_trie_free(local);
- bc_trie_free(variables);
-}
-
-
-static void
-test_build_blogc_cmd_print(void **state)
-{
- bc_trie_t *variables = bc_trie_new(free);
- bc_trie_insert(variables, "LOL", bc_strdup("HEHE"));
- bc_trie_t *local = bc_trie_new(free);
- bc_trie_insert(local, "ASD", bc_strdup("QWE"));
-
- char *rv = bm_exec_build_blogc_cmd("blogc", NULL, variables, local, "LOL",
- false, NULL, NULL, NULL, false, true);
- assert_string_equal(rv, "blogc -D LOL='HEHE' -D ASD='QWE' -p LOL -i");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", NULL, variables, local, "LOL", true,
- NULL, NULL, NULL, false, false);
- assert_string_equal(rv, "blogc -D LOL='HEHE' -D ASD='QWE' -p LOL -l");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", NULL, variables, NULL, "LOL", false,
- NULL, NULL, NULL, false, true);
- assert_string_equal(rv,
- "blogc -D LOL='HEHE' -p LOL -i");
- free(rv);
-
- rv = bm_exec_build_blogc_cmd("blogc", NULL, NULL, NULL, "LOL", false, NULL,
- NULL, NULL, false, false);
- assert_string_equal(rv,
- "blogc -p LOL");
- free(rv);
-
- bc_trie_free(local);
- bc_trie_free(variables);
-}
-
-
-int
-main(void)
-{
- const struct CMUnitTest tests[] = {
-#ifndef MAKE_EMBEDDED
- cmocka_unit_test(test_find_binary),
-#endif
- cmocka_unit_test(test_build_blogc_cmd_with_settings),
- cmocka_unit_test(test_build_blogc_cmd_with_settings_and_dev),
- cmocka_unit_test(test_build_blogc_cmd_with_settings_and_tags),
- cmocka_unit_test(test_build_blogc_cmd_without_settings),
- cmocka_unit_test(test_build_blogc_cmd_print),
- };
- return cmocka_run_group_tests(tests, NULL, NULL);
-}
diff --git a/tests/blogc-make/check_rules.c b/tests/blogc-make/check_rules.c
deleted file mode 100644
index 5da412f..0000000
--- a/tests/blogc-make/check_rules.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * blogc: A blog compiler.
- * Copyright (C) 2014-2019 Rafael G. Martins <rafael@rafaelmartins.eng.br>
- *
- * This program can be distributed under the terms of the BSD License.
- * See the file LICENSE.
- */
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "../../src/blogc-make/rules.h"
-#include "../../src/common/utils.h"
-
-
-static void
-test_rule_parse_args(void **state)
-{
- bc_trie_t *t = bm_rule_parse_args("bola:foo=" + 4);
- assert_non_null(t);
- assert_int_equal(bc_trie_size(t), 1);
- assert_string_equal(bc_trie_lookup(t, "foo"), "");
- bc_trie_free(t);
- t = bm_rule_parse_args("bola:foo=bar" + 4);
- assert_non_null(t);
- assert_int_equal(bc_trie_size(t), 1);
- assert_string_equal(bc_trie_lookup(t, "foo"), "bar");
- bc_trie_free(t);
- t = bm_rule_parse_args("bola:foo=,baz=lol" + 4);
- assert_non_null(t);
- assert_int_equal(bc_trie_size(t), 2);
- assert_string_equal(bc_trie_lookup(t, "foo"), "");
- assert_string_equal(bc_trie_lookup(t, "baz"), "lol");
- bc_trie_free(t);
- t = bm_rule_parse_args("bola:foo=bar,baz=" + 4);
- assert_non_null(t);
- assert_int_equal(bc_trie_size(t), 2);
- assert_string_equal(bc_trie_lookup(t, "foo"), "bar");
- assert_string_equal(bc_trie_lookup(t, "baz"), "");
- bc_trie_free(t);
- t = bm_rule_parse_args("bola:foo=bar,baz=lol" + 4);
- assert_non_null(t);
- assert_int_equal(bc_trie_size(t), 2);
- assert_string_equal(bc_trie_lookup(t, "foo"), "bar");
- assert_string_equal(bc_trie_lookup(t, "baz"), "lol");
- bc_trie_free(t);
- t = bm_rule_parse_args("bola:foo=,baz=lol,asd=qwe" + 4);
- assert_non_null(t);
- assert_int_equal(bc_trie_size(t), 3);
- assert_string_equal(bc_trie_lookup(t, "foo"), "");
- assert_string_equal(bc_trie_lookup(t, "baz"), "lol");
- assert_string_equal(bc_trie_lookup(t, "asd"), "qwe");
- bc_trie_free(t);
- t = bm_rule_parse_args("bola:foo=bar,baz=,asd=qwe" + 4);
- assert_non_null(t);
- assert_int_equal(bc_trie_size(t), 3);
- assert_string_equal(bc_trie_lookup(t, "foo"), "bar");
- assert_string_equal(bc_trie_lookup(t, "baz"), "");
- assert_string_equal(bc_trie_lookup(t, "asd"), "qwe");
- bc_trie_free(t);
- t = bm_rule_parse_args("bola:foo=bar,baz=lol,asd=" + 4);
- assert_non_null(t);
- assert_int_equal(bc_trie_size(t), 3);
- assert_string_equal(bc_trie_lookup(t, "foo"), "bar");
- assert_string_equal(bc_trie_lookup(t, "baz"), "lol");
- assert_string_equal(bc_trie_lookup(t, "asd"), "");
- bc_trie_free(t);
- t = bm_rule_parse_args("bola:foo=bar,baz=lol,asd=qwe" + 4);
- assert_non_null(t);
- assert_int_equal(bc_trie_size(t), 3);
- assert_string_equal(bc_trie_lookup(t, "foo"), "bar");
- assert_string_equal(bc_trie_lookup(t, "baz"), "lol");
- assert_string_equal(bc_trie_lookup(t, "asd"), "qwe");
- bc_trie_free(t);
-}
-
-
-static void
-test_rule_parse_args_error(void **state)
-{
- assert_null(bm_rule_parse_args(NULL));
- assert_null(bm_rule_parse_args("bola" + 4));
- assert_null(bm_rule_parse_args("bola:" + 4));
- assert_null(bm_rule_parse_args("bola:asd" + 4));
- assert_null(bm_rule_parse_args("bola:asd=foo,lol" + 4));
- assert_null(bm_rule_parse_args("bola:asd=foo,qwe=bar,lol" + 4));
- assert_null(bm_rule_parse_args("bolaasd" + 4));
-}
-
-
-int
-main(void)
-{
- const struct CMUnitTest tests[] = {
- cmocka_unit_test(test_rule_parse_args),
- cmocka_unit_test(test_rule_parse_args_error),
- };
- return cmocka_run_group_tests(tests, NULL, NULL);
-}
diff --git a/tests/blogc-make/check_settings.c b/tests/blogc-make/check_settings.c
deleted file mode 100644
index b268570..0000000
--- a/tests/blogc-make/check_settings.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * blogc: A blog compiler.
- * Copyright (C) 2014-2019 Rafael G. Martins <rafael@rafaelmartins.eng.br>
- *
- * This program can be distributed under the terms of the BSD License.
- * See the file LICENSE.
- */
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "../../src/blogc-make/settings.h"
-#include "../../src/common/error.h"
-#include "../../src/common/utils.h"
-
-
-static void
-test_settings_empty(void **state)
-{
- const char *a = "";
- bc_error_t *err = NULL;
- bm_settings_t *s = bm_settings_parse(a, strlen(a), &err);
- assert_non_null(err);
- assert_null(s);
- assert_int_equal(err->type, BLOGC_MAKE_ERROR_SETTINGS);
- assert_string_equal(err->msg,
- "[global] key required but not found or empty: AUTHOR_NAME");
- bc_error_free(err);
-}
-
-
-static void
-test_settings(void **state)
-{
- const char *a =
- "[settings]\n"
- "content_dir = guda\n"
- "main_template = foo.tmpl\n"
- "\n"
- "[global]\n"
- "BOLA = asd\n"
- "GUDA = qwe\n";
- bc_error_t *err = NULL;
- bm_settings_t *s = bm_settings_parse(a, strlen(a), &err);
- assert_non_null(err);
- assert_null(s);
- assert_int_equal(err->type, BLOGC_MAKE_ERROR_SETTINGS);
- assert_string_equal(err->msg,
- "[global] key required but not found or empty: AUTHOR_NAME");
- bc_error_free(err);
-
- a =
- "[settings]\n"
- "content_dir = guda\n"
- "main_template = foo.tmpl\n"
- "\n"
- "[global]\n"
- "bOLA = asd\n"
- "GUDA = qwe\n";
- err = NULL;
- s = bm_settings_parse(a, strlen(a), &err);
- assert_non_null(err);
- assert_null(s);
- assert_int_equal(err->type, BLOGC_MAKE_ERROR_SETTINGS);
- assert_string_equal(err->msg,
- "Invalid [global] key (first character must be uppercase): bOLA");
- bc_error_free(err);
-
- a =
- "[settings]\n"
- "content_dir = guda\n"
- "main_template = foo.tmpl\n"
- "\n"
- "[global]\n"
- "BOLA = asd\n"
- "GUDa = qwe\n";
- err = NULL;
- s = bm_settings_parse(a, strlen(a), &err);
- assert_non_null(err);
- assert_null(s);
- assert_int_equal(err->type, BLOGC_MAKE_ERROR_SETTINGS);
- assert_string_equal(err->msg,
- "Invalid [global] key (must be uppercase with '_' and digits after first character): GUDa");
- bc_error_free(err);
-}
-
-
-static void
-test_settings_env(void **state)
-{
- const char *a =
- "[settings]\n"
- "content_dir = guda\n"
- "main_template = foo.tmpl\n"
- "\n"
- "[environment]\n"
- "BOLA = asd\n"
- "GUDA = qwe\n";
- bc_error_t *err = NULL;
- bm_settings_t *s = bm_settings_parse(a, strlen(a), &err);
- assert_non_null(err);
- assert_null(s);
- assert_int_equal(err->type, BLOGC_MAKE_ERROR_SETTINGS);
- assert_string_equal(err->msg,
- "[environment] key required but not found or empty: AUTHOR_NAME");
- bc_error_free(err);
-}
-
-
-static void
-test_settings2(void **state)
-{
- const char *a =
- "[settings]\n"
- "content_dir = guda\n"
- "main_template = foo.tmpl\n"
- "\n"
- "[global]\n"
- "BOLA = asd\n"
- "GUDA = qwe\n"
- "AUTHOR_NAME = chunda\n"
- "AUTHOR_EMAIL = chunda@example.com\n"
- "SITE_TITLE = Fuuuuuuuuu\n"
- "SITE_TAGLINE = My cool tagline\n"
- "BASE_DOMAIN = http://example.com\n"
- "\n"
- "[posts]\n"
- "\n"
- "aaaa\n"
- "bbbb\n"
- "cccc\n"
- "[pages]\n"
- " dddd\n"
- "eeee\n"
- "ffff\n"
- "[tags]\n"
- "gggg\n"
- "\n"
- " hhhh\n"
- "iiii\n"
- "[copy]\n"
- "jjjj\n"
- "kkkk\n"
- "llll\n";
- bc_error_t *err = NULL;
- bm_settings_t *s = bm_settings_parse(a, strlen(a), &err);
- assert_null(err);
- assert_non_null(s);
- assert_int_equal(bc_trie_size(s->global), 7);
- assert_string_equal(bc_trie_lookup(s->global, "BOLA"), "asd");
- assert_string_equal(bc_trie_lookup(s->global, "GUDA"), "qwe");
- assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_NAME"), "chunda");
- assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_EMAIL"), "chunda@example.com");
- assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu");
- assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline");
- assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com");
- assert_int_equal(bc_trie_size(s->settings), 16);
- assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt");
- assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html");
- assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda");
- assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates");
- assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl");
- assert_string_equal(bc_trie_lookup(s->settings, "date_format"),
- "%b %d, %Y, %I:%M %p GMT");
- assert_string_equal(bc_trie_lookup(s->settings, "posts_per_page"), "10");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_prefix"), "atom");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_ext"), ".xml");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_posts_per_page"), "10");
- assert_string_equal(bc_trie_lookup(s->settings, "pagination_prefix"), "page");
- assert_string_equal(bc_trie_lookup(s->settings, "post_prefix"), "post");
- assert_string_equal(bc_trie_lookup(s->settings, "tag_prefix"), "tag");
- assert_string_equal(bc_trie_lookup(s->settings, "html_order"), "DESC");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_order"), "DESC");
- assert_string_equal(bc_trie_lookup(s->settings, "index_prefix"), "");
- assert_non_null(s->posts);
- assert_string_equal(s->posts[0], "aaaa");
- assert_string_equal(s->posts[1], "bbbb");
- assert_string_equal(s->posts[2], "cccc");
- assert_null(s->posts[3]);
- assert_non_null(s->pages);
- assert_string_equal(s->pages[0], "dddd");
- assert_string_equal(s->pages[1], "eeee");
- assert_string_equal(s->pages[2], "ffff");
- assert_null(s->pages[3]);
- assert_non_null(s->copy);
- assert_string_equal(s->copy[0], "jjjj");
- assert_string_equal(s->copy[1], "kkkk");
- assert_string_equal(s->copy[2], "llll");
- assert_null(s->copy[3]);
- assert_non_null(s->tags);
- assert_string_equal(s->tags[0], "gggg");
- assert_string_equal(s->tags[1], "hhhh");
- assert_string_equal(s->tags[2], "iiii");
- assert_null(s->tags[3]);
- bm_settings_free(s);
-}
-
-
-static void
-test_settings_env2(void **state)
-{
- const char *a =
- "[settings]\n"
- "content_dir = guda\n"
- "main_template = foo.tmpl\n"
- "\n"
- "[environment]\n"
- "BOLA = asd\n"
- "GUDA = qwe\n"
- "AUTHOR_NAME = chunda\n"
- "AUTHOR_EMAIL = chunda@example.com\n"
- "SITE_TITLE = Fuuuuuuuuu\n"
- "SITE_TAGLINE = My cool tagline\n"
- "BASE_DOMAIN = http://example.com\n"
- "\n"
- "[posts]\n"
- "\n"
- "aaaa\n"
- "bbbb\n"
- "cccc\n"
- "[pages]\n"
- " dddd\n"
- "eeee\n"
- "ffff\n"
- "[tags]\n"
- "gggg\n"
- "\n"
- " hhhh\n"
- "iiii\n"
- "[copy]\n"
- "jjjj\n"
- "kkkk\n"
- "llll\n";
- bc_error_t *err = NULL;
- bm_settings_t *s = bm_settings_parse(a, strlen(a), &err);
- assert_null(err);
- assert_non_null(s);
- assert_int_equal(bc_trie_size(s->global), 7);
- assert_string_equal(bc_trie_lookup(s->global, "BOLA"), "asd");
- assert_string_equal(bc_trie_lookup(s->global, "GUDA"), "qwe");
- assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_NAME"), "chunda");
- assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_EMAIL"), "chunda@example.com");
- assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu");
- assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline");
- assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com");
- assert_int_equal(bc_trie_size(s->settings), 16);
- assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt");
- assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html");
- assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda");
- assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates");
- assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl");
- assert_string_equal(bc_trie_lookup(s->settings, "date_format"),
- "%b %d, %Y, %I:%M %p GMT");
- assert_string_equal(bc_trie_lookup(s->settings, "posts_per_page"), "10");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_prefix"), "atom");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_ext"), ".xml");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_posts_per_page"), "10");
- assert_string_equal(bc_trie_lookup(s->settings, "pagination_prefix"), "page");
- assert_string_equal(bc_trie_lookup(s->settings, "post_prefix"), "post");
- assert_string_equal(bc_trie_lookup(s->settings, "tag_prefix"), "tag");
- assert_string_equal(bc_trie_lookup(s->settings, "html_order"), "DESC");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_order"), "DESC");
- assert_string_equal(bc_trie_lookup(s->settings, "index_prefix"), "");
- assert_non_null(s->posts);
- assert_string_equal(s->posts[0], "aaaa");
- assert_string_equal(s->posts[1], "bbbb");
- assert_string_equal(s->posts[2], "cccc");
- assert_null(s->posts[3]);
- assert_non_null(s->pages);
- assert_string_equal(s->pages[0], "dddd");
- assert_string_equal(s->pages[1], "eeee");
- assert_string_equal(s->pages[2], "ffff");
- assert_null(s->pages[3]);
- assert_non_null(s->copy);
- assert_string_equal(s->copy[0], "jjjj");
- assert_string_equal(s->copy[1], "kkkk");
- assert_string_equal(s->copy[2], "llll");
- assert_null(s->copy[3]);
- assert_non_null(s->tags);
- assert_string_equal(s->tags[0], "gggg");
- assert_string_equal(s->tags[1], "hhhh");
- assert_string_equal(s->tags[2], "iiii");
- assert_null(s->tags[3]);
- bm_settings_free(s);
-}
-
-
-static void
-test_settings_copy_files(void **state)
-{
- const char *a =
- "[settings]\n"
- "content_dir = guda\n"
- "main_template = foo.tmpl\n"
- "\n"
- "[global]\n"
- "BOLA = asd\n"
- "GUDA = qwe\n"
- "AUTHOR_NAME = chunda\n"
- "AUTHOR_EMAIL = chunda@example.com\n"
- "SITE_TITLE = Fuuuuuuuuu\n"
- "SITE_TAGLINE = My cool tagline\n"
- "BASE_DOMAIN = http://example.com\n"
- "\n"
- "[posts]\n"
- "\n"
- "aaaa\n"
- "bbbb\n"
- "cccc\n"
- "[pages]\n"
- " dddd\n"
- "eeee\n"
- "ffff\n"
- "[tags]\n"
- "gggg\n"
- "\n"
- " hhhh\n"
- "iiii\n"
- "[copy_files]\n"
- "jjjj\n"
- "kkkk\n"
- "llll\n";
- bc_error_t *err = NULL;
- bm_settings_t *s = bm_settings_parse(a, strlen(a), &err);
- assert_null(err);
- assert_non_null(s);
- assert_int_equal(bc_trie_size(s->global), 7);
- assert_string_equal(bc_trie_lookup(s->global, "BOLA"), "asd");
- assert_string_equal(bc_trie_lookup(s->global, "GUDA"), "qwe");
- assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_NAME"), "chunda");
- assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_EMAIL"), "chunda@example.com");
- assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu");
- assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline");
- assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com");
- assert_int_equal(bc_trie_size(s->settings), 16);
- assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt");
- assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html");
- assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda");
- assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates");
- assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl");
- assert_string_equal(bc_trie_lookup(s->settings, "date_format"),
- "%b %d, %Y, %I:%M %p GMT");
- assert_string_equal(bc_trie_lookup(s->settings, "posts_per_page"), "10");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_prefix"), "atom");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_ext"), ".xml");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_posts_per_page"), "10");
- assert_string_equal(bc_trie_lookup(s->settings, "pagination_prefix"), "page");
- assert_string_equal(bc_trie_lookup(s->settings, "post_prefix"), "post");
- assert_string_equal(bc_trie_lookup(s->settings, "tag_prefix"), "tag");
- assert_string_equal(bc_trie_lookup(s->settings, "html_order"), "DESC");
- assert_string_equal(bc_trie_lookup(s->settings, "atom_order"), "DESC");
- assert_string_equal(bc_trie_lookup(s->settings, "index_prefix"), "");
- assert_non_null(s->posts);
- assert_string_equal(s->posts[0], "aaaa");
- assert_string_equal(s->posts[1], "bbbb");
- assert_string_equal(s->posts[2], "cccc");
- assert_null(s->posts[3]);
- assert_non_null(s->pages);
- assert_string_equal(s->pages[0], "dddd");
- assert_string_equal(s->pages[1], "eeee");
- assert_string_equal(s->pages[2], "ffff");
- assert_null(s->pages[3]);
- assert_non_null(s->copy);
- assert_string_equal(s->copy[0], "jjjj");
- assert_string_equal(s->copy[1], "kkkk");
- assert_string_equal(s->copy[2], "llll");
- assert_null(s->copy[3]);
- assert_non_null(s->tags);
- assert_string_equal(s->tags[0], "gggg");
- assert_string_equal(s->tags[1], "hhhh");
- assert_string_equal(s->tags[2], "iiii");
- assert_null(s->tags[3]);
- bm_settings_free(s);
-}
-
-
-int
-main(void)
-{
- const struct CMUnitTest tests[] = {
- cmocka_unit_test(test_settings_empty),
- cmocka_unit_test(test_settings),
- cmocka_unit_test(test_settings_env),
- cmocka_unit_test(test_settings2),
- cmocka_unit_test(test_settings_env2),
- cmocka_unit_test(test_settings_copy_files),
- };
- return cmocka_run_group_tests(tests, NULL, NULL);
-}
diff --git a/tests/blogc-make/check_utils.c b/tests/blogc-make/check_utils.c
deleted file mode 100644
index 09d1580..0000000
--- a/tests/blogc-make/check_utils.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * blogc: A blog compiler.
- * Copyright (C) 2014-2019 Rafael G. Martins <rafael@rafaelmartins.eng.br>
- *
- * This program can be distributed under the terms of the BSD License.
- * See the file LICENSE.
- */
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-#include <stdlib.h>
-
-#include "../../src/blogc-make/utils.h"
-#include "../../src/common/utils.h"
-
-
-static void
-test_generate_filename(void **state)
-{
- char *rv;
-
- assert_null(bm_generate_filename(NULL, NULL, NULL, NULL));
- assert_null(bm_generate_filename(NULL, "", "", ""));
- assert_null(bm_generate_filename("_build", NULL, NULL, NULL));
- assert_null(bm_generate_filename("_build", "", "", ""));
-
- rv = bm_generate_filename(NULL, NULL, NULL, ".html");
- assert_string_equal(rv, "/index.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, NULL, NULL, "/index.html");
- assert_string_equal(rv, "/index.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, "lol", NULL, ".html");
- assert_string_equal(rv, "/lol.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, "lol", NULL, "/index.html");
- assert_string_equal(rv, "/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, NULL, "foo", ".html");
- assert_string_equal(rv, "/foo.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, NULL, "foo", "/index.html");
- assert_string_equal(rv, "/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, NULL, "index", ".html");
- assert_string_equal(rv, "/index.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, "lol", "index", ".html");
- assert_string_equal(rv, "/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, NULL, "index", "/index.html");
- assert_string_equal(rv, "/index.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, "lol", "index", "/index.html");
- assert_string_equal(rv, "/lol/index/index.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, "bar", "foo", ".html");
- assert_string_equal(rv, "/bar/foo.html");
- free(rv);
-
- rv = bm_generate_filename(NULL, "bar", "foo", "/index.html");
- assert_string_equal(rv, "/bar/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename("_build", NULL, NULL, ".html");
- assert_string_equal(rv, "_build/index.html");
- free(rv);
-
- rv = bm_generate_filename("_build", NULL, NULL, "/index.html");
- assert_string_equal(rv, "_build/index.html");
- free(rv);
-
- rv = bm_generate_filename("_build", "lol", NULL, ".html");
- assert_string_equal(rv, "_build/lol.html");
- free(rv);
-
- rv = bm_generate_filename("_build", "lol", NULL, "/index.html");
- assert_string_equal(rv, "_build/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename("_build", NULL, "foo", ".html");
- assert_string_equal(rv, "_build/foo.html");
- free(rv);
-
- rv = bm_generate_filename("_build", NULL, "foo", "/index.html");
- assert_string_equal(rv, "_build/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename("_build", NULL, "index", ".html");
- assert_string_equal(rv, "_build/index.html");
- free(rv);
-
- rv = bm_generate_filename("_build", "lol", "index", ".html");
- assert_string_equal(rv, "_build/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename("_build", NULL, "index", "/index.html");
- assert_string_equal(rv, "_build/index.html");
- free(rv);
-
- rv = bm_generate_filename("_build", "lol", "index", "/index.html");
- assert_string_equal(rv, "_build/lol/index/index.html");
- free(rv);
-
- rv = bm_generate_filename("_build", "bar", "foo", ".html");
- assert_string_equal(rv, "_build/bar/foo.html");
- free(rv);
-
- rv = bm_generate_filename("_build", "bar", "foo", "/index.html");
- assert_string_equal(rv, "_build/bar/foo/index.html");
- free(rv);
-}
-
-
-static void
-test_generate_filename2(void **state)
-{
- char *rv;
-
- assert_null(bm_generate_filename2(NULL, NULL, NULL, NULL, NULL, NULL));
- assert_null(bm_generate_filename2(NULL, "", "", "", "", ""));
- assert_null(bm_generate_filename2("_build", NULL, NULL, NULL, NULL, NULL));
- assert_null(bm_generate_filename2("_build", "", "", "", "", ""));
-
- rv = bm_generate_filename2(NULL, NULL, NULL, NULL, NULL, ".html");
- assert_string_equal(rv, "/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", NULL, NULL, NULL, ".html");
- assert_string_equal(rv, "/p.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, "q", NULL, NULL, ".html");
- assert_string_equal(rv, "/q.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", "q", NULL, NULL, ".html");
- assert_string_equal(rv, "/p/q.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, NULL, NULL, NULL, "/index.html");
- assert_string_equal(rv, "/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", NULL, NULL, NULL, "/index.html");
- assert_string_equal(rv, "/p/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, "q", NULL, NULL, "/index.html");
- assert_string_equal(rv, "/q/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", "q", NULL, NULL, "/index.html");
- assert_string_equal(rv, "/p/q/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, NULL, "lol", NULL, ".html");
- assert_string_equal(rv, "/lol.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", NULL, "lol", NULL, ".html");
- assert_string_equal(rv, "/p/lol.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, "q", "lol", NULL, ".html");
- assert_string_equal(rv, "/q/lol.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", "q", "lol", NULL, ".html");
- assert_string_equal(rv, "/p/q/lol.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, NULL, "lol", NULL, "/index.html");
- assert_string_equal(rv, "/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", NULL, "lol", NULL, "/index.html");
- assert_string_equal(rv, "/p/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, "q", "lol", NULL, "/index.html");
- assert_string_equal(rv, "/q/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", "q", "lol", NULL, "/index.html");
- assert_string_equal(rv, "/p/q/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, NULL, NULL, "foo", ".html");
- assert_string_equal(rv, "/foo.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", NULL, NULL, "foo", ".html");
- assert_string_equal(rv, "/p/foo.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, "q", NULL, "foo", ".html");
- assert_string_equal(rv, "/q/foo.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", "q", NULL, "foo", ".html");
- assert_string_equal(rv, "/p/q/foo.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, NULL, NULL, "foo", "/index.html");
- assert_string_equal(rv, "/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", NULL, NULL, "foo", "/index.html");
- assert_string_equal(rv, "/p/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, "q", NULL, "foo", "/index.html");
- assert_string_equal(rv, "/q/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", "q", NULL, "foo", "/index.html");
- assert_string_equal(rv, "/p/q/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, NULL, NULL, "index", ".html");
- assert_string_equal(rv, "/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", NULL, NULL, "index", ".html");
- assert_string_equal(rv, "/p/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, "q", NULL, "index", ".html");
- assert_string_equal(rv, "/q/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", "q", NULL, "index", ".html");
- assert_string_equal(rv, "/p/q/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, NULL, NULL, "index", "/index.html");
- assert_string_equal(rv, "/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", NULL, NULL, "index", "/index.html");
- assert_string_equal(rv, "/p/index/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, "q", NULL, "index", "/index.html");
- assert_string_equal(rv, "/q/index/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", "q", NULL, "index", "/index.html");
- assert_string_equal(rv, "/p/q/index/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, NULL, "bar", "foo", ".html");
- assert_string_equal(rv, "/bar/foo.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", NULL, "bar", "foo", ".html");
- assert_string_equal(rv, "/p/bar/foo.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, "q", "bar", "foo", ".html");
- assert_string_equal(rv, "/q/bar/foo.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", "q", "bar", "foo", ".html");
- assert_string_equal(rv, "/p/q/bar/foo.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, NULL, "bar", "foo", "/index.html");
- assert_string_equal(rv, "/bar/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", NULL, "bar", "foo", "/index.html");
- assert_string_equal(rv, "/p/bar/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, NULL, "q", "bar", "foo", "/index.html");
- assert_string_equal(rv, "/q/bar/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2(NULL, "p", "q", "bar", "foo", "/index.html");
- assert_string_equal(rv, "/p/q/bar/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, NULL, NULL, NULL, ".html");
- assert_string_equal(rv, "_build/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", NULL, NULL, NULL, ".html");
- assert_string_equal(rv, "_build/p.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, "q", NULL, NULL, ".html");
- assert_string_equal(rv, "_build/q.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", "q", NULL, NULL, ".html");
- assert_string_equal(rv, "_build/p/q.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, NULL, NULL, NULL, "/index.html");
- assert_string_equal(rv, "_build/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", NULL, NULL, NULL, "/index.html");
- assert_string_equal(rv, "_build/p/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, "q", NULL, NULL, "/index.html");
- assert_string_equal(rv, "_build/q/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", "q", NULL, NULL, "/index.html");
- assert_string_equal(rv, "_build/p/q/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, NULL, "lol", NULL, ".html");
- assert_string_equal(rv, "_build/lol.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", NULL, "lol", NULL, ".html");
- assert_string_equal(rv, "_build/p/lol.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, "q", "lol", NULL, ".html");
- assert_string_equal(rv, "_build/q/lol.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", "q", "lol", NULL, ".html");
- assert_string_equal(rv, "_build/p/q/lol.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, NULL, "lol", NULL, "/index.html");
- assert_string_equal(rv, "_build/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", NULL, "lol", NULL, "/index.html");
- assert_string_equal(rv, "_build/p/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, "q", "lol", NULL, "/index.html");
- assert_string_equal(rv, "_build/q/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", "q", "lol", NULL, "/index.html");
- assert_string_equal(rv, "_build/p/q/lol/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, NULL, NULL, "foo", ".html");
- assert_string_equal(rv, "_build/foo.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", NULL, NULL, "foo", ".html");
- assert_string_equal(rv, "_build/p/foo.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, "q", NULL, "foo", ".html");
- assert_string_equal(rv, "_build/q/foo.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", "q", NULL, "foo", ".html");
- assert_string_equal(rv, "_build/p/q/foo.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, NULL, NULL, "foo", "/index.html");
- assert_string_equal(rv, "_build/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", NULL, NULL, "foo", "/index.html");
- assert_string_equal(rv, "_build/p/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, "q", NULL, "foo", "/index.html");
- assert_string_equal(rv, "_build/q/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", "q", NULL, "foo", "/index.html");
- assert_string_equal(rv, "_build/p/q/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, NULL, NULL, "index", ".html");
- assert_string_equal(rv, "_build/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", NULL, NULL, "index", ".html");
- assert_string_equal(rv, "_build/p/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, "q", NULL, "index", ".html");
- assert_string_equal(rv, "_build/q/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", "q", NULL, "index", ".html");
- assert_string_equal(rv, "_build/p/q/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, NULL, NULL, "index", "/index.html");
- assert_string_equal(rv, "_build/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", NULL, NULL, "index", "/index.html");
- assert_string_equal(rv, "_build/p/index/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, "q", NULL, "index", "/index.html");
- assert_string_equal(rv, "_build/q/index/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", "q", NULL, "index", "/index.html");
- assert_string_equal(rv, "_build/p/q/index/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, NULL, "bar", "foo", ".html");
- assert_string_equal(rv, "_build/bar/foo.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", NULL, "bar", "foo", ".html");
- assert_string_equal(rv, "_build/p/bar/foo.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, "q", "bar", "foo", ".html");
- assert_string_equal(rv, "_build/q/bar/foo.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", "q", "bar", "foo", ".html");
- assert_string_equal(rv, "_build/p/q/bar/foo.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, NULL, "bar", "foo", "/index.html");
- assert_string_equal(rv, "_build/bar/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", NULL, "bar", "foo", "/index.html");
- assert_string_equal(rv, "_build/p/bar/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", NULL, "q", "bar", "foo", "/index.html");
- assert_string_equal(rv, "_build/q/bar/foo/index.html");
- free(rv);
-
- rv = bm_generate_filename2("_build", "p", "q", "bar", "foo", "/index.html");
- assert_string_equal(rv, "_build/p/q/bar/foo/index.html");
- free(rv);
-}
-
-
-int
-main(void)
-{
- const struct CMUnitTest tests[] = {
- cmocka_unit_test(test_generate_filename),
- cmocka_unit_test(test_generate_filename2),
- };
- return cmocka_run_group_tests(tests, NULL, NULL);
-}