grim/gplate

Parents 5bd4354c8ea8
Children ec39b68558fa
consolidated all of the tests to /tests and made them get run by default. There's a ton of work to do here yet, since some are still in "check" format and others fail
  • +1 -0
    CMakeLists.txt
  • +0 -3
    gplate/CMakeLists.txt
  • +0 -4
    gplate/functions/CMakeLists.txt
  • +0 -15
    gplate/functions/tests/CMakeLists.txt
  • +0 -2
    gplate/functions/tests/templates/footer.gplate
  • +0 -5
    gplate/functions/tests/templates/header.gplate
  • +0 -1
    gplate/functions/tests/templates/html.gplate
  • +0 -1
    gplate/functions/tests/templates/simple-include.gplate
  • +0 -4
    gplate/functions/tests/templates/simple.gplate
  • +0 -189
    gplate/functions/tests/test-gplate-for-function.c
  • +0 -132
    gplate/functions/tests/test-gplate-include-function.c
  • +0 -4
    gplate/tags/CMakeLists.txt
  • +0 -29
    gplate/tags/tests/CMakeLists.txt
  • +0 -82
    gplate/tags/tests/test-gplate-comment-tag.c
  • +0 -56
    gplate/tags/tests/test-gplate-tag.c
  • +0 -51
    gplate/tags/tests/test-gplate-tag.h
  • +0 -73
    gplate/tags/tests/test-gplate-text-tag.c
  • +0 -237
    gplate/tags/tests/test-gplate-variable-tag.c
  • +0 -22
    gplate/tests/CMakeLists.txt
  • +0 -35
    gplate/tests/test-gplate-collection-interface.c
  • +0 -60
    gplate/tests/test-gplate-utility-functions.c
  • +30 -0
    tests/CMakeLists.txt
  • +2 -0
    tests/templates/footer.gplate
  • +5 -0
    tests/templates/header.gplate
  • +1 -0
    tests/templates/html.gplate
  • +1 -0
    tests/templates/simple-include.gplate
  • +4 -0
    tests/templates/simple.gplate
  • +35 -0
    tests/test-gplate-collection-interface.c
  • +82 -0
    tests/test-gplate-comment-tag.c
  • +189 -0
    tests/test-gplate-for-function.c
  • +132 -0
    tests/test-gplate-include-function.c
  • +56 -0
    tests/test-gplate-tag.c
  • +51 -0
    tests/test-gplate-tag.h
  • +73 -0
    tests/test-gplate-text-tag.c
  • +60 -0
    tests/test-gplate-utility-functions.c
  • +237 -0
    tests/test-gplate-variable-tag.c
  • --- a/CMakeLists.txt Mon Sep 03 17:52:20 2012 -0500
    +++ b/CMakeLists.txt Mon Sep 03 18:45:07 2012 -0500
    @@ -63,6 +63,7 @@
    # Subdirectories
    ###############################################################################
    add_subdirectory(gplate)
    +add_subdirectory(tests)
    ###############################################################################
    # Config Files
    --- a/gplate/CMakeLists.txt Mon Sep 03 17:52:20 2012 -0500
    +++ b/gplate/CMakeLists.txt Mon Sep 03 18:45:07 2012 -0500
    @@ -1,10 +1,7 @@
    add_subdirectory(functions)
    -add_subdirectory(tests)
    add_subdirectory(tags)
    add_subdirectory(variables)
    -enable_testing()
    -
    set(GPLATE_HEADERS
    gplate.h
    gplate-collection.h
    --- a/gplate/functions/CMakeLists.txt Mon Sep 03 17:52:20 2012 -0500
    +++ b/gplate/functions/CMakeLists.txt Mon Sep 03 18:45:07 2012 -0500
    @@ -1,7 +1,3 @@
    -add_subdirectory(tests)
    -
    -enable_testing()
    -
    set(GPLATE_FUNCTIONS_HEADERS
    gplate-for-function.h
    gplate-include-function.h
    --- a/gplate/functions/tests/CMakeLists.txt Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,15 +0,0 @@
    -enable_testing()
    -
    -add_executable(test-gplate-for-function test-gplate-for-function.c)
    -target_link_libraries(test-gplate-for-function gplate)
    -list(APPEND FUNCTION_TESTS test-gplate-for-function)
    -
    -add_executable(test-gplate-include-function test-gplate-include-function.c)
    -target_link_libraries(test-gplate-include-function gplate)
    -list(APPEND FUNCTION_TESTS test-gplate-for-function)
    -
    -add_test(GPlateFunctions
    - ${GTESTER} -k --verbose -o test-gplate-function.log
    - ${FUNCTION_TESTS}
    -)
    -
    --- a/gplate/functions/tests/templates/footer.gplate Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,2 +0,0 @@
    - </body>
    -</html>
    --- a/gplate/functions/tests/templates/header.gplate Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,5 +0,0 @@
    -<html>
    - <head>
    - <title>test</title>
    - </head>
    - <body>
    --- a/gplate/functions/tests/templates/html.gplate Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,1 +0,0 @@
    -{% include "header.gplate" %}in the body{% include "footer.gplate" %}
    --- a/gplate/functions/tests/templates/simple-include.gplate Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,1 +0,0 @@
    -included!
    --- a/gplate/functions/tests/templates/simple.gplate Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,4 +0,0 @@
    -including
    -{% include "simple-include.gplate" %}
    -done
    -
    --- a/gplate/functions/tests/test-gplate-for-function.c Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,189 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * This library is free software: you can redistribute it and/or modify
    - * it under the terms of the GNU Lesser General Public License as published by
    - * the Free Software Foundation, either version 3 of the License, or
    - * (at your option) any later version.
    - *
    - * This library is distributed in the hope that it will be useful,
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    - * GNU Lesser General Public License for more details.
    - *
    - * You should have received a copy of the GNU Lesser General Public License
    - * along with this library. If not, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -#include <gplate/variables/gplate-dictionary-variable.h>
    -
    -#include <glib.h>
    -
    -/******************************************************************************
    - * Structs
    - *****************************************************************************/
    -typedef struct {
    - const gchar *name;
    - const gchar *value;
    -} TestGPlateForFunctionData;
    -
    -typedef struct {
    - GPlateTemplate *template;
    -
    - GPlateVariable *dict;
    -
    - const gchar *template_string;
    -
    - gchar *actual;
    - const gchar *expected;
    -
    - GError *error;
    -
    - TestGPlateForFunctionData *data;
    -} TestGPlateForFunctionFixture;
    -
    -/******************************************************************************
    - * Fixtures
    - *****************************************************************************/
    -static void
    -test_gplate_for_function_setup(TestGPlateForFunctionFixture *fixture,
    - gconstpointer d)
    -{
    - fixture->template = gplate_template_new();
    - fixture->dict = gplate_dictionary_variable_new("list");
    -
    - gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
    - fixture->dict);
    -}
    -
    -static void
    -test_gplate_for_function_teardown(TestGPlateForFunctionFixture *fixture,
    - gconstpointer d)
    -{
    - g_object_unref(fixture->template);
    - fixture->template = NULL;
    -
    - g_object_unref(fixture->dict);
    - fixture->dict = NULL;
    -
    - g_free(fixture->actual);
    - fixture->actual = NULL;
    -
    - fixture->expected = NULL;
    -
    - if(fixture->error) {
    - g_error_free(fixture->error);
    - fixture->error = NULL;
    - }
    -}
    -
    -/******************************************************************************
    - * Helpers
    - *****************************************************************************/
    -static void
    -test_gplate_for_function(TestGPlateForFunctionFixture *fixture) {
    - gint i = 0;
    -
    - /* add the variables */
    - for(i = 0; fixture->data[i].name; i++) {
    - gplate_collection_add_string(fixture->dict,
    - fixture->data[i].name,
    - fixture->data[i].value);
    - }
    -
    - fixture->actual = gplate_template_render(fixture->template,
    - fixture->template_string,
    - &fixture->error);
    -
    - g_assert(fixture->error == NULL);
    -
    - g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    -}
    -
    -/******************************************************************************
    - * Simple For's
    - *****************************************************************************/
    -static void
    -test_gplate_for_function_zero_elements(TestGPlateForFunctionFixture *fixture,
    - gconstpointer user_data)
    -{
    - TestGPlateForFunctionData data[] = {
    - { NULL, NULL },
    - };
    -
    - fixture->data = data;
    - fixture->template_string = "{% for in in line %}{{ i }}{% endfor %}";
    - fixture->expected = "";
    -
    - test_gplate_for_function(fixture);
    -}
    -
    -static void
    -test_gplate_for_function_one_element(TestGPlateForFunctionFixture *fixture,
    - gconstpointer user_data)
    -{
    - TestGPlateForFunctionData data[] = {
    - { "one", "1" },
    - { NULL, NULL },
    - };
    -
    - fixture->data = data;
    - fixture->template_string = "{% for i in list %}{{ i }}{% endfor %}";
    - fixture->expected = "1";
    -
    - test_gplate_for_function(fixture);
    -}
    -
    -static void
    -test_gplate_for_function_two_elements(TestGPlateForFunctionFixture *fixture,
    - gconstpointer user_data)
    -{
    - TestGPlateForFunctionData data[] = {
    - { "a", "A" },
    - { "b", "B" },
    - { NULL, NULL },
    - };
    -
    - fixture->data = data;
    - fixture->template_string = "{% for i in list %}{{ i }}{% endfor %}";
    - fixture->expected = "AB";
    -
    - test_gplate_for_function(fixture);
    -}
    -
    -/******************************************************************************
    - * Main!
    - *****************************************************************************/
    -gint
    -main(gint argc, gchar **argv) {
    - g_test_init(&argc, &argv, NULL);
    -
    - g_type_init();
    -
    - gplate_config_load_default();
    -
    - g_test_add("/functions/foo/zero_elements",
    - TestGPlateForFunctionFixture,
    - NULL,
    - test_gplate_for_function_setup,
    - test_gplate_for_function_zero_elements,
    - test_gplate_for_function_teardown);
    -
    - g_test_add("/functions/foo/one_element",
    - TestGPlateForFunctionFixture,
    - NULL,
    - test_gplate_for_function_setup,
    - test_gplate_for_function_one_element,
    - test_gplate_for_function_teardown);
    -
    - g_test_add("/functions/foo/two_elements",
    - TestGPlateForFunctionFixture,
    - NULL,
    - test_gplate_for_function_setup,
    - test_gplate_for_function_two_elements,
    - test_gplate_for_function_teardown);
    -
    - return g_test_run();
    -}
    -
    --- a/gplate/functions/tests/test-gplate-include-function.c Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,132 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * This library is free software: you can redistribute it and/or modify
    - * it under the terms of the GNU Lesser General Public License as published by
    - * the Free Software Foundation, either version 3 of the License, or
    - * (at your option) any later version.
    - *
    - * This library is distributed in the hope that it will be useful,
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    - * GNU Lesser General Public License for more details.
    - *
    - * You should have received a copy of the GNU Lesser General Public License
    - * along with this library. If not, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -/******************************************************************************
    - * Structs
    - *****************************************************************************/
    -typedef struct {
    - GPlateTemplate *template;
    -
    - const gchar *template_string;
    -
    - gchar *actual;
    - const gchar *expected;
    -
    - GError *error;
    -} TestGPlateIncludeFunctionFixture;
    -
    -/******************************************************************************
    - * Fixtures
    - *****************************************************************************/
    -static void
    -test_gplate_include_function_setup(TestGPlateIncludeFunctionFixture *fixture,
    - gconstpointer d)
    -{
    - fixture->template = gplate_template_new();
    -}
    -
    -static void
    -test_gplate_include_function_teardown(TestGPlateIncludeFunctionFixture *fixture,
    - gconstpointer d)
    -{
    - g_object_unref(fixture->template);
    - fixture->template = NULL;
    -
    - g_free(fixture->actual);
    - fixture->actual = NULL;
    -
    - fixture->expected = NULL;
    -
    - if(fixture->error) {
    - g_error_free(fixture->error);
    - fixture->error = NULL;
    - }
    -}
    -
    -/******************************************************************************
    - * Tests
    - *****************************************************************************/
    -static void
    -test_gplate_include_function_simple(TestGPlateIncludeFunctionFixture *fixture,
    - gconstpointer data)
    -{
    - fixture->expected = "including\nincluded!\ndone";
    -
    - fixture->actual = gplate_template_render_file(fixture->template,
    - "templates/simple.gplate",
    - &fixture->error);
    -
    - g_assert(fixture->error == NULL);
    -
    - g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    -}
    -
    -static void
    -test_gplate_include_function_double(TestGPlateIncludeFunctionFixture *fixture,
    - gconstpointer data)
    -{
    - fixture->expected = " \
    -<html>\
    - <head>\
    - <title>test</title>\
    - </head>\
    - <body>\
    -in the body\
    - </body>\
    -</html>";
    -
    - fixture->actual = gplate_template_render_file(fixture->template,
    - "templates/html.gplate",
    - &fixture->error);
    -
    - g_assert(fixture->error == NULL);
    -
    - g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    -}
    -
    -/******************************************************************************
    - * Main!
    - *****************************************************************************/
    -gint
    -main(gint argc, gchar **argv) {
    - g_test_init(&argc, &argv, NULL);
    -
    - g_type_init();
    -
    - gplate_config_load_default();
    -
    - g_test_add("/functions/include/simple",
    - TestGPlateIncludeFunctionFixture,
    - NULL,
    - test_gplate_include_function_setup,
    - test_gplate_include_function_simple,
    - test_gplate_include_function_teardown);
    -
    - g_test_add("/functions/include/double",
    - TestGPlateIncludeFunctionFixture,
    - NULL,
    - test_gplate_include_function_setup,
    - test_gplate_include_function_double,
    - test_gplate_include_function_teardown);
    -
    - return g_test_run();
    -}
    -
    --- a/gplate/tags/CMakeLists.txt Mon Sep 03 17:52:20 2012 -0500
    +++ b/gplate/tags/CMakeLists.txt Mon Sep 03 18:45:07 2012 -0500
    @@ -1,7 +1,3 @@
    -add_subdirectory(tests)
    -
    -enable_testing()
    -
    set(GPLATE_TAGS_HEADERS
    gplate-code-tag.h
    gplate-comment-tag.h
    --- a/gplate/tags/tests/CMakeLists.txt Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,29 +0,0 @@
    -enable_testing()
    -
    -# define the static library for tag testing
    -add_library(test-gplate-tag STATIC
    - test-gplate-tag.c
    -)
    -target_link_libraries(test-gplate-tag gplate)
    -
    -# add the text tag tests
    -add_executable(test-gplate-text-tag test-gplate-text-tag.c)
    -target_link_libraries(test-gplate-text-tag test-gplate-tag)
    -list(APPEND TAG_TESTS test-gplate-text-tag)
    -
    -# add the variable tag tests
    -add_executable(test-gplate-variable-tag test-gplate-variable-tag.c)
    -target_link_libraries(test-gplate-variable-tag test-gplate-tag)
    -list(APPEND TAG_TESTS test-gplate-variable-tag)
    -
    -# add the comment tag tests
    -add_executable(test-gplate-comment-tag test-gplate-comment-tag.c)
    -target_link_libraries(test-gplate-comment-tag test-gplate-tag)
    -list(APPEND TAG_TESTS test-gplate-comment-tag)
    -
    -# add the tests for gtester
    -add_test(GPlateTagTests
    - ${GTESTER} -k --verbose -o test-gplate-tag.log
    - ${TAG_TESTS}
    -)
    -
    --- a/gplate/tags/tests/test-gplate-comment-tag.c Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,82 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * This library is free software: you can redistribute it and/or modify
    - * it under the terms of the GNU Lesser General Public License as published by
    - * the Free Software Foundation, either version 3 of the License, or
    - * (at your option) any later version.
    - *
    - * This library is distributed in the hope that it will be useful,
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    - * GNU Lesser General Public License for more details.
    - *
    - * You should have received a copy of the GNU Lesser General Public License
    - * along with this library. If not, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -#include "test-gplate-tag.h"
    -
    -/******************************************************************************
    - * Tests
    - *****************************************************************************/
    -static void
    -test_gplate_comment_tag_empty(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data, "{##}", "");
    -}
    -
    -static void
    -test_gplate_comment_tag_whitespace(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data, "{# #}", "");
    - test_gplate_tag_output(fixture, data, "{#\t#}", "");
    - test_gplate_tag_output(fixture, data, "{#\n#}", "");
    - test_gplate_tag_output(fixture, data, "{#\r#}", "");
    - test_gplate_tag_output(fixture, data, "{#\r\n#}", "");
    - test_gplate_tag_output(fixture, data, "{#\n\r#}", "");
    -}
    -
    -static void
    -test_gplate_comment_tag_simple(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data, "{# foo#}", "");
    - test_gplate_tag_output(fixture, data, "{#foo #}", "");
    - test_gplate_tag_output(fixture, data, "{#\tfoo#}", "");
    - test_gplate_tag_output(fixture, data, "{#foo\t#}", "");
    - test_gplate_tag_output(fixture, data, "{#\nfoo#}", "");
    - test_gplate_tag_output(fixture, data, "{#foo\n#}", "");
    - test_gplate_tag_output(fixture, data, "{#\rfoo#}", "");
    - test_gplate_tag_output(fixture, data, "{#foo\r#}", "");
    - test_gplate_tag_output(fixture, data, "{#\r\nfoo#}", "");
    - test_gplate_tag_output(fixture, data, "{#foo\r\n#}", "");
    -}
    -
    -/******************************************************************************
    - * Main
    - *****************************************************************************/
    -gint
    -main(gint argc, gchar **argv) {
    - g_test_init(&argc, &argv, NULL);
    -
    - g_type_init();
    -
    - gplate_config_load_default();
    -
    - test_gplate_tag_add("/tags/comment/empty",
    - test_gplate_comment_tag_empty);
    - test_gplate_tag_add("/tags/comment/whitespace",
    - test_gplate_comment_tag_whitespace);
    - test_gplate_tag_add("/tags/comment/simple",
    - test_gplate_comment_tag_simple);
    -
    - return g_test_run();
    -}
    -
    --- a/gplate/tags/tests/test-gplate-tag.c Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,56 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * This library is free software: you can redistribute it and/or modify
    - * it under the terms of the GNU Lesser General Public License as published by
    - * the Free Software Foundation, either version 3 of the License, or
    - * (at your option) any later version.
    - *
    - * This library is distributed in the hope that it will be useful,
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    - * GNU Lesser General Public License for more details.
    - *
    - * You should have received a copy of the GNU Lesser General Public License
    - * along with this library. If not, see <http://www.gnu.org/licenses/>.
    - */
    -#include "test-gplate-tag.h"
    -
    -void
    -test_gplate_tag_setup(TestGPlateTagFixture *fixture, gconstpointer data) {
    - fixture->template = gplate_template_new();
    -}
    -
    -void
    -test_gplate_tag_teardown(TestGPlateTagFixture *fixture, gconstpointer data) {
    - g_object_unref(fixture->template);
    - fixture->template = NULL;
    -
    - if(fixture->error) {
    - g_error_free(fixture->error);
    - fixture->error = NULL;
    - }
    -
    - g_free(fixture->actual);
    - fixture->actual = NULL;
    -}
    -
    -void
    -test_gplate_tag_output(TestGPlateTagFixture *fixture,
    - gconstpointer data,
    - const gchar *template_string,
    - const gchar *expected)
    -{
    - fixture->template_string = template_string;
    - fixture->expected = expected;
    -
    - fixture->actual = gplate_template_render(fixture->template,
    - fixture->template_string,
    - &fixture->error);
    -
    - g_assert(fixture->error == NULL);
    -
    - g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    -}
    -
    --- a/gplate/tags/tests/test-gplate-tag.h Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,51 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * This library is free software: you can redistribute it and/or modify
    - * it under the terms of the GNU Lesser General Public License as published by
    - * the Free Software Foundation, either version 3 of the License, or
    - * (at your option) any later version.
    - *
    - * This library is distributed in the hope that it will be useful,
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    - * GNU Lesser General Public License for more details.
    - *
    - * You should have received a copy of the GNU Lesser General Public License
    - * along with this library. If not, see <http://www.gnu.org/licenses/>.
    - */
    -#ifndef TEST_GPLATE_TAG_H
    -#define TEST_GPLATE_TAG_H
    -
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -#define test_gplate_tag_add(path, func) \
    - g_test_add((path), TestGPlateTagFixture, NULL, test_gplate_tag_setup, (func), test_gplate_tag_teardown)
    -
    -typedef struct _TestGPlateTagFixture TestGPlateTagFixture;
    -
    -typedef void (*TestGPlateTagFixtureFunc)(TestGPlateTagFixture *fixture, gconstpointer data);
    -
    -struct _TestGPlateTagFixture {
    - GPlateTemplate *template;
    - GError *error;
    -
    - const gchar *template_string;
    -
    - const gchar *expected;
    - gchar *actual;
    -};
    -
    -G_BEGIN_DECLS
    -
    -void test_gplate_tag_setup(TestGPlateTagFixture *fixture, gconstpointer data);
    -void test_gplate_tag_teardown(TestGPlateTagFixture *fixture, gconstpointer data);
    -void test_gplate_tag_output(TestGPlateTagFixture *fixture, gconstpointer data, const gchar *template_string, const gchar *expected);
    -
    -G_END_DECLS
    -
    -#endif /* TEST_GPLATE_TAG_H */
    -
    --- a/gplate/tags/tests/test-gplate-text-tag.c Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,73 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * This library is free software: you can redistribute it and/or modify
    - * it under the terms of the GNU Lesser General Public License as published by
    - * the Free Software Foundation, either version 3 of the License, or
    - * (at your option) any later version.
    - *
    - * This library is distributed in the hope that it will be useful,
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    - * GNU Lesser General Public License for more details.
    - *
    - * You should have received a copy of the GNU Lesser General Public License
    - * along with this library. If not, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -#include "test-gplate-tag.h"
    -
    -/******************************************************************************
    - * Tests
    - *****************************************************************************/
    -static void
    -test_gplate_text_tag_syntax_plain(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data,
    - "simple template", "simple template");
    -}
    -
    -static void
    -test_gplate_text_tag_syntax_keywords(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data,
    - "extends if else endif for endfor",
    - "extends if else endif for endfor");
    -}
    -
    -static void
    -test_gplate_text_tag_syntax_keywords_case_sensitive(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data,
    - "EXteNds iF eLse enDif fOr enDFor",
    - "EXteNds iF eLse enDif fOr enDFor");
    -}
    -
    -/******************************************************************************
    - * Main
    - *****************************************************************************/
    -gint
    -main(gint argc, gchar **argv) {
    - g_test_init(&argc, &argv, NULL);
    -
    - g_type_init();
    -
    - gplate_config_load_default();
    -
    - test_gplate_tag_add("/tags/text/plain",
    - test_gplate_text_tag_syntax_plain);
    - test_gplate_tag_add("/tags/text/keywords",
    - test_gplate_text_tag_syntax_keywords);
    - test_gplate_tag_add("/tags/text/keywords_case_sensitive",
    - test_gplate_text_tag_syntax_keywords_case_sensitive);
    -
    - return g_test_run();
    -}
    -
    --- a/gplate/tags/tests/test-gplate-variable-tag.c Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,237 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * This library is free software: you can redistribute it and/or modify
    - * it under the terms of the GNU Lesser General Public License as published by
    - * the Free Software Foundation, either version 3 of the License, or
    - * (at your option) any later version.
    - *
    - * This library is distributed in the hope that it will be useful,
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    - * GNU Lesser General Public License for more details.
    - *
    - * You should have received a copy of the GNU Lesser General Public License
    - * along with this library. If not, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -#include "test-gplate-tag.h"
    -
    -/******************************************************************************
    - * Helpers
    - *****************************************************************************/
    -static void
    -test_gplate_variable_tag(TestGPlateTagFixture *fixture, gconstpointer data,
    - const gchar *template_string, const gchar *expected,
    - ...)
    -{
    - va_list vargs;
    - const gchar *name = NULL, *value = NULL;
    -
    - va_start(vargs, expected);
    - while((name = va_arg(vargs, const gchar *))) {
    - value = va_arg(vargs, const gchar *);
    -
    - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    - name, value);
    - }
    - va_end(vargs);
    -
    - test_gplate_tag_output(fixture, data, template_string, expected);
    -}
    -
    -/******************************************************************************
    - * Tests
    - *****************************************************************************/
    -static void
    -test_gplate_variable_tag_single(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{ foo }}", "foo",
    - "foo", "foo",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_double(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{ foo }}{{ bar }}", "foobar",
    - "foo", "foo",
    - "bar", "bar",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_tripple(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{ foo }}{{ bar }}{{ baz }}", "foobarbaz",
    - "foo", "foo",
    - "bar", "bar",
    - "baz", "baz",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_newline_prefix(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{\nfoo}}", "foo",
    - "foo", "foo",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_newline_suffix(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{foo\n}}", "foo",
    - "foo", "foo",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_newline_wrapped(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{\nfoo\n}}", "foo",
    - "foo", "foo",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_single_quotes(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "foo '{{ bar }}' baz", "foo 'bar' baz",
    - "bar", "bar",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_double_quotes(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "foo \"{{ bar }}\" baz", "foo \"bar\" baz",
    - "bar", "bar",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_mixed_quotes(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "foo \"{{ bar }}' baz", "foo \"bar' baz",
    - "bar", "bar",
    - NULL);
    -
    - test_gplate_variable_tag(fixture, data,
    - "foo '{{ bar }}\" baz", "foo 'bar\" baz",
    - "bar", "bar",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_two_vars_one_block(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "one {{ two five }} three",
    - "one 2 three",
    - "two", "2",
    - "five", "5",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_nested_single(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - GPlateVariable *dict = gplate_dictionary_variable_new("foo");
    -
    - gplate_collection_add_string(GPLATE_COLLECTION(dict),
    - "bar", "baz");
    -
    - test_gplate_tag_output(fixture, data, "{{ foo.bar }}", "baz");
    -}
    -
    -static void
    -test_gplate_variable_tag_nested_double(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - GPlateVariable *dict1 = gplate_dictionary_variable_new("foo");
    - GPlateVariable *dict2 = gplate_dictionary_variable_new("bar");
    -
    - gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
    - dict1);
    - gplate_collection_add_variable(GPLATE_COLLECTION(dict1), dict2);
    - gplate_collection_add_string(GPLATE_COLLECTION(dict2),
    - "baz", "42");
    -
    - test_gplate_tag_output(fixture, data, "{{ foo.bar.baz }}", "42");
    -}
    -
    -/******************************************************************************
    - * Main
    - *****************************************************************************/
    -gint
    -main(gint argc, gchar **argv) {
    - g_test_init(&argc, &argv, NULL);
    -
    - g_type_init();
    -
    - gplate_config_load_default();
    -
    - test_gplate_tag_add("/tags/variable/single",
    - test_gplate_variable_tag_single);
    -
    - test_gplate_tag_add("/tags/variable/double",
    - test_gplate_variable_tag_double);
    -
    - test_gplate_tag_add("/tags/variable/tripple",
    - test_gplate_variable_tag_tripple);
    -
    - test_gplate_tag_add("/tags/variable/newline_prefix",
    - test_gplate_variable_tag_newline_prefix);
    -
    - test_gplate_tag_add("/tags/variable/newline_suffix",
    - test_gplate_variable_tag_newline_suffix);
    -
    - test_gplate_tag_add("/tags/variable/newline_wrapped",
    - test_gplate_variable_tag_newline_wrapped);
    -
    - test_gplate_tag_add("/tags/variable/quotes/single",
    - test_gplate_variable_tag_single_quotes);
    -
    - test_gplate_tag_add("/tags/variable/quotes/double",
    - test_gplate_variable_tag_double_quotes);
    -
    - test_gplate_tag_add("/tags/variable/quotes/mixed",
    - test_gplate_variable_tag_mixed_quotes);
    -
    - test_gplate_tag_add("/tags/variable/two_vars_one_block",
    - test_gplate_variable_tag_two_vars_one_block);
    -
    - test_gplate_tag_add("/tags/variables/nested/single",
    - test_gplate_variable_tag_nested_single);
    -
    - test_gplate_tag_add("/tags/variable/nested/double",
    - test_gplate_variable_tag_nested_double);
    -
    - return g_test_run();
    -}
    -
    --- a/gplate/tests/CMakeLists.txt Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,22 +0,0 @@
    -enable_testing()
    -
    -###############################################################################
    -# collection tests
    -###############################################################################
    -add_executable(test-gplate-collection-interface test-gplate-collection-interface.c)
    -target_link_libraries(test-gplate-collection-interface gplate)
    -add_test(GPlateCollectionInterface
    - ${GTESTER} -k --verbose -o test-gplate-collection-interface.log
    - test-gplate-collection-interface
    -)
    -
    -###############################################################################
    -# utility tests
    -###############################################################################
    -add_executable(test-gplate-utility-functions test-gplate-utility-functions.c)
    -target_link_libraries(test-gplate-utility-functions gplate)
    -add_test(GPlateUtilityFunctions
    - ${GTESTER} -k --verbose -o test-gplate-utility-functions.log
    - test-gplate-utility-functions
    -)
    -
    --- a/gplate/tests/test-gplate-collection-interface.c Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,35 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * This library is free software: you can redistribute it and/or modify
    - * it under the terms of the GNU Lesser General Public License as published by
    - * the Free Software Foundation, either version 3 of the License, or
    - * (at your option) any later version.
    - *
    - * This library is distributed in the hope that it will be useful,
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    - * GNU Lesser General Public License for more details.
    - *
    - * You should have received a copy of the GNU Lesser General Public License
    - * along with this library. If not, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -/******************************************************************************
    - * Main
    - *****************************************************************************/
    -gint
    -main(gint argc, gchar **argv) {
    - g_test_init(&argc, &argv, NULL);
    -
    - g_type_init();
    -
    - gplate_config_load_default();
    -
    - return g_test_run();
    -}
    -
    --- a/gplate/tests/test-gplate-utility-functions.c Mon Sep 03 17:52:20 2012 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,60 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * This library is free software: you can redistribute it and/or modify
    - * it under the terms of the GNU Lesser General Public License as published by
    - * the Free Software Foundation, either version 3 of the License, or
    - * (at your option) any later version.
    - *
    - * This library is distributed in the hope that it will be useful,
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    - * GNU Lesser General Public License for more details.
    - *
    - * You should have received a copy of the GNU Lesser General Public License
    - * along with this library. If not, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -static void
    -gplate_util_test_quoted_string_helper(const gchar *string,
    - const gchar *contents, gboolean value)
    -{
    - gboolean r = FALSE;
    - gchar *c = NULL;
    -
    - r = gplate_util_is_quoted_string(string, &c);
    - g_assert_cmpint(r, ==, value);
    -
    - if(contents)
    - g_assert_cmpstr(c, ==, contents);
    -
    - g_free(c);
    -}
    -
    -static void
    -gplate_util_test_quoted_string(void) {
    - gplate_util_test_quoted_string_helper("\"abc\"", "abc", TRUE);
    - gplate_util_test_quoted_string_helper("\"abc def\"", "abc def", TRUE);
    - gplate_util_test_quoted_string_helper("\"abc\tdef\bghi\"", "abc\tdef\bghi", TRUE);
    - gplate_util_test_quoted_string_helper("abc \"def\"", NULL, FALSE);
    - gplate_util_test_quoted_string_helper("\"abc\" def", NULL, FALSE);
    - gplate_util_test_quoted_string_helper("'abc'", "abc", TRUE);
    - gplate_util_test_quoted_string_helper("'abc def'", "abc def", TRUE);
    - gplate_util_test_quoted_string_helper("'abc\tdef\bghi'", "abc\tdef\bghi", TRUE);
    - gplate_util_test_quoted_string_helper("abc 'def'", NULL, FALSE);
    - gplate_util_test_quoted_string_helper("'abc' def", NULL, FALSE);
    - gplate_util_test_quoted_string_helper("'abc\"", NULL, FALSE);
    - gplate_util_test_quoted_string_helper("\"abc'", NULL, FALSE);
    -}
    -
    -gint
    -main(gint argc, gchar **argv) {
    - g_test_init(&argc, &argv, NULL);
    -
    - g_test_add_func("/util/quoted_string", gplate_util_test_quoted_string);
    -
    - return g_test_run();
    -}
    -
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/CMakeLists.txt Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,30 @@
    +macro(add_gtest target)
    + add_executable(${target} ${target}.c)
    + target_link_libraries(${target} ${GLIB_LIBRARIES} gplate)
    +
    + get_target_property(_output_name ${target} RUNTIME_OUTPUT_NAME)
    + if(${_output_name})
    + else(${_output_name})
    + get_target_property(_output_name ${target} LOCATION)
    + endif(${_output_name})
    +
    + list(APPEND TESTS ${_output_name})
    +endmacro(add_gtest)
    +
    +add_gtest(test-gplate-collection-interface)
    +add_gtest(test-gplate-utility-functions)
    +add_gtest(test-gplate-for-function)
    +add_gtest(test-gplate-include-function)
    +add_gtest(test-gplate-comment-tag)
    +add_gtest(test-gplate-text-tag)
    +add_gtest(test-gplate-variable-tag)
    +add_gtest(test-variables)
    +
    +set(GTESTER_TESTS "${TESTS}")
    +set(GTESTER_LOG "testgplate.log")
    +
    +add_custom_target(tests ALL
    + COMMAND ${GTESTER} -k -verbose -o ${GTESTER_LOG} ${GTESTER_TESTS}
    + DEPENDS ${GTESTER_TESTS}
    +)
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/templates/footer.gplate Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,2 @@
    + </body>
    +</html>
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/templates/header.gplate Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,5 @@
    +<html>
    + <head>
    + <title>test</title>
    + </head>
    + <body>
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/templates/html.gplate Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,1 @@
    +{% include "header.gplate" %}in the body{% include "footer.gplate" %}
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/templates/simple-include.gplate Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,1 @@
    +included!
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/templates/simple.gplate Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,4 @@
    +including
    +{% include "simple-include.gplate" %}
    +done
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/test-gplate-collection-interface.c Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,35 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with this library. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +/******************************************************************************
    + * Main
    + *****************************************************************************/
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + g_type_init();
    +
    + gplate_config_load_default();
    +
    + return g_test_run();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/test-gplate-comment-tag.c Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,82 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with this library. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +#include "test-gplate-tag.h"
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +static void
    +test_gplate_comment_tag_empty(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data, "{##}", "");
    +}
    +
    +static void
    +test_gplate_comment_tag_whitespace(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data, "{# #}", "");
    + test_gplate_tag_output(fixture, data, "{#\t#}", "");
    + test_gplate_tag_output(fixture, data, "{#\n#}", "");
    + test_gplate_tag_output(fixture, data, "{#\r#}", "");
    + test_gplate_tag_output(fixture, data, "{#\r\n#}", "");
    + test_gplate_tag_output(fixture, data, "{#\n\r#}", "");
    +}
    +
    +static void
    +test_gplate_comment_tag_simple(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data, "{# foo#}", "");
    + test_gplate_tag_output(fixture, data, "{#foo #}", "");
    + test_gplate_tag_output(fixture, data, "{#\tfoo#}", "");
    + test_gplate_tag_output(fixture, data, "{#foo\t#}", "");
    + test_gplate_tag_output(fixture, data, "{#\nfoo#}", "");
    + test_gplate_tag_output(fixture, data, "{#foo\n#}", "");
    + test_gplate_tag_output(fixture, data, "{#\rfoo#}", "");
    + test_gplate_tag_output(fixture, data, "{#foo\r#}", "");
    + test_gplate_tag_output(fixture, data, "{#\r\nfoo#}", "");
    + test_gplate_tag_output(fixture, data, "{#foo\r\n#}", "");
    +}
    +
    +/******************************************************************************
    + * Main
    + *****************************************************************************/
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + g_type_init();
    +
    + gplate_config_load_default();
    +
    + test_gplate_tag_add("/tags/comment/empty",
    + test_gplate_comment_tag_empty);
    + test_gplate_tag_add("/tags/comment/whitespace",
    + test_gplate_comment_tag_whitespace);
    + test_gplate_tag_add("/tags/comment/simple",
    + test_gplate_comment_tag_simple);
    +
    + return g_test_run();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/test-gplate-for-function.c Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,189 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with this library. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +#include <gplate/variables/gplate-dictionary-variable.h>
    +
    +#include <glib.h>
    +
    +/******************************************************************************
    + * Structs
    + *****************************************************************************/
    +typedef struct {
    + const gchar *name;
    + const gchar *value;
    +} TestGPlateForFunctionData;
    +
    +typedef struct {
    + GPlateTemplate *template;
    +
    + GPlateVariable *dict;
    +
    + const gchar *template_string;
    +
    + gchar *actual;
    + const gchar *expected;
    +
    + GError *error;
    +
    + TestGPlateForFunctionData *data;
    +} TestGPlateForFunctionFixture;
    +
    +/******************************************************************************
    + * Fixtures
    + *****************************************************************************/
    +static void
    +test_gplate_for_function_setup(TestGPlateForFunctionFixture *fixture,
    + gconstpointer d)
    +{
    + fixture->template = gplate_template_new();
    + fixture->dict = gplate_dictionary_variable_new("list");
    +
    + gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
    + fixture->dict);
    +}
    +
    +static void
    +test_gplate_for_function_teardown(TestGPlateForFunctionFixture *fixture,
    + gconstpointer d)
    +{
    + g_object_unref(fixture->template);
    + fixture->template = NULL;
    +
    + g_object_unref(fixture->dict);
    + fixture->dict = NULL;
    +
    + g_free(fixture->actual);
    + fixture->actual = NULL;
    +
    + fixture->expected = NULL;
    +
    + if(fixture->error) {
    + g_error_free(fixture->error);
    + fixture->error = NULL;
    + }
    +}
    +
    +/******************************************************************************
    + * Helpers
    + *****************************************************************************/
    +static void
    +test_gplate_for_function(TestGPlateForFunctionFixture *fixture) {
    + gint i = 0;
    +
    + /* add the variables */
    + for(i = 0; fixture->data[i].name; i++) {
    + gplate_collection_add_string(fixture->dict,
    + fixture->data[i].name,
    + fixture->data[i].value);
    + }
    +
    + fixture->actual = gplate_template_render(fixture->template,
    + fixture->template_string,
    + &fixture->error);
    +
    + g_assert(fixture->error == NULL);
    +
    + g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    +}
    +
    +/******************************************************************************
    + * Simple For's
    + *****************************************************************************/
    +static void
    +test_gplate_for_function_zero_elements(TestGPlateForFunctionFixture *fixture,
    + gconstpointer user_data)
    +{
    + TestGPlateForFunctionData data[] = {
    + { NULL, NULL },
    + };
    +
    + fixture->data = data;
    + fixture->template_string = "{% for in in line %}{{ i }}{% endfor %}";
    + fixture->expected = "";
    +
    + test_gplate_for_function(fixture);
    +}
    +
    +static void
    +test_gplate_for_function_one_element(TestGPlateForFunctionFixture *fixture,
    + gconstpointer user_data)
    +{
    + TestGPlateForFunctionData data[] = {
    + { "one", "1" },
    + { NULL, NULL },
    + };
    +
    + fixture->data = data;
    + fixture->template_string = "{% for i in list %}{{ i }}{% endfor %}";
    + fixture->expected = "1";
    +
    + test_gplate_for_function(fixture);
    +}
    +
    +static void
    +test_gplate_for_function_two_elements(TestGPlateForFunctionFixture *fixture,
    + gconstpointer user_data)
    +{
    + TestGPlateForFunctionData data[] = {
    + { "a", "A" },
    + { "b", "B" },
    + { NULL, NULL },
    + };
    +
    + fixture->data = data;
    + fixture->template_string = "{% for i in list %}{{ i }}{% endfor %}";
    + fixture->expected = "AB";
    +
    + test_gplate_for_function(fixture);
    +}
    +
    +/******************************************************************************
    + * Main!
    + *****************************************************************************/
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + g_type_init();
    +
    + gplate_config_load_default();
    +
    + g_test_add("/functions/foo/zero_elements",
    + TestGPlateForFunctionFixture,
    + NULL,
    + test_gplate_for_function_setup,
    + test_gplate_for_function_zero_elements,
    + test_gplate_for_function_teardown);
    +
    + g_test_add("/functions/foo/one_element",
    + TestGPlateForFunctionFixture,
    + NULL,
    + test_gplate_for_function_setup,
    + test_gplate_for_function_one_element,
    + test_gplate_for_function_teardown);
    +
    + g_test_add("/functions/foo/two_elements",
    + TestGPlateForFunctionFixture,
    + NULL,
    + test_gplate_for_function_setup,
    + test_gplate_for_function_two_elements,
    + test_gplate_for_function_teardown);
    +
    + return g_test_run();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/test-gplate-include-function.c Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,132 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with this library. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +/******************************************************************************
    + * Structs
    + *****************************************************************************/
    +typedef struct {
    + GPlateTemplate *template;
    +
    + const gchar *template_string;
    +
    + gchar *actual;
    + const gchar *expected;
    +
    + GError *error;
    +} TestGPlateIncludeFunctionFixture;
    +
    +/******************************************************************************
    + * Fixtures
    + *****************************************************************************/
    +static void
    +test_gplate_include_function_setup(TestGPlateIncludeFunctionFixture *fixture,
    + gconstpointer d)
    +{
    + fixture->template = gplate_template_new();
    +}
    +
    +static void
    +test_gplate_include_function_teardown(TestGPlateIncludeFunctionFixture *fixture,
    + gconstpointer d)
    +{
    + g_object_unref(fixture->template);
    + fixture->template = NULL;
    +
    + g_free(fixture->actual);
    + fixture->actual = NULL;
    +
    + fixture->expected = NULL;
    +
    + if(fixture->error) {
    + g_error_free(fixture->error);
    + fixture->error = NULL;
    + }
    +}
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +static void
    +test_gplate_include_function_simple(TestGPlateIncludeFunctionFixture *fixture,
    + gconstpointer data)
    +{
    + fixture->expected = "including\nincluded!\ndone";
    +
    + fixture->actual = gplate_template_render_file(fixture->template,
    + "templates/simple.gplate",
    + &fixture->error);
    +
    + g_assert(fixture->error == NULL);
    +
    + g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    +}
    +
    +static void
    +test_gplate_include_function_double(TestGPlateIncludeFunctionFixture *fixture,
    + gconstpointer data)
    +{
    + fixture->expected = " \
    +<html>\
    + <head>\
    + <title>test</title>\
    + </head>\
    + <body>\
    +in the body\
    + </body>\
    +</html>";
    +
    + fixture->actual = gplate_template_render_file(fixture->template,
    + "templates/html.gplate",
    + &fixture->error);
    +
    + g_assert(fixture->error == NULL);
    +
    + g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    +}
    +
    +/******************************************************************************
    + * Main!
    + *****************************************************************************/
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + g_type_init();
    +
    + gplate_config_load_default();
    +
    + g_test_add("/functions/include/simple",
    + TestGPlateIncludeFunctionFixture,
    + NULL,
    + test_gplate_include_function_setup,
    + test_gplate_include_function_simple,
    + test_gplate_include_function_teardown);
    +
    + g_test_add("/functions/include/double",
    + TestGPlateIncludeFunctionFixture,
    + NULL,
    + test_gplate_include_function_setup,
    + test_gplate_include_function_double,
    + test_gplate_include_function_teardown);
    +
    + return g_test_run();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/test-gplate-tag.c Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,56 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with this library. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include "test-gplate-tag.h"
    +
    +void
    +test_gplate_tag_setup(TestGPlateTagFixture *fixture, gconstpointer data) {
    + fixture->template = gplate_template_new();
    +}
    +
    +void
    +test_gplate_tag_teardown(TestGPlateTagFixture *fixture, gconstpointer data) {
    + g_object_unref(fixture->template);
    + fixture->template = NULL;
    +
    + if(fixture->error) {
    + g_error_free(fixture->error);
    + fixture->error = NULL;
    + }
    +
    + g_free(fixture->actual);
    + fixture->actual = NULL;
    +}
    +
    +void
    +test_gplate_tag_output(TestGPlateTagFixture *fixture,
    + gconstpointer data,
    + const gchar *template_string,
    + const gchar *expected)
    +{
    + fixture->template_string = template_string;
    + fixture->expected = expected;
    +
    + fixture->actual = gplate_template_render(fixture->template,
    + fixture->template_string,
    + &fixture->error);
    +
    + g_assert(fixture->error == NULL);
    +
    + g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/test-gplate-tag.h Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,51 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with this library. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#ifndef TEST_GPLATE_TAG_H
    +#define TEST_GPLATE_TAG_H
    +
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +#define test_gplate_tag_add(path, func) \
    + g_test_add((path), TestGPlateTagFixture, NULL, test_gplate_tag_setup, (func), test_gplate_tag_teardown)
    +
    +typedef struct _TestGPlateTagFixture TestGPlateTagFixture;
    +
    +typedef void (*TestGPlateTagFixtureFunc)(TestGPlateTagFixture *fixture, gconstpointer data);
    +
    +struct _TestGPlateTagFixture {
    + GPlateTemplate *template;
    + GError *error;
    +
    + const gchar *template_string;
    +
    + const gchar *expected;
    + gchar *actual;
    +};
    +
    +G_BEGIN_DECLS
    +
    +void test_gplate_tag_setup(TestGPlateTagFixture *fixture, gconstpointer data);
    +void test_gplate_tag_teardown(TestGPlateTagFixture *fixture, gconstpointer data);
    +void test_gplate_tag_output(TestGPlateTagFixture *fixture, gconstpointer data, const gchar *template_string, const gchar *expected);
    +
    +G_END_DECLS
    +
    +#endif /* TEST_GPLATE_TAG_H */
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/test-gplate-text-tag.c Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,73 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with this library. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +#include "test-gplate-tag.h"
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +static void
    +test_gplate_text_tag_syntax_plain(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data,
    + "simple template", "simple template");
    +}
    +
    +static void
    +test_gplate_text_tag_syntax_keywords(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data,
    + "extends if else endif for endfor",
    + "extends if else endif for endfor");
    +}
    +
    +static void
    +test_gplate_text_tag_syntax_keywords_case_sensitive(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data,
    + "EXteNds iF eLse enDif fOr enDFor",
    + "EXteNds iF eLse enDif fOr enDFor");
    +}
    +
    +/******************************************************************************
    + * Main
    + *****************************************************************************/
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + g_type_init();
    +
    + gplate_config_load_default();
    +
    + test_gplate_tag_add("/tags/text/plain",
    + test_gplate_text_tag_syntax_plain);
    + test_gplate_tag_add("/tags/text/keywords",
    + test_gplate_text_tag_syntax_keywords);
    + test_gplate_tag_add("/tags/text/keywords_case_sensitive",
    + test_gplate_text_tag_syntax_keywords_case_sensitive);
    +
    + return g_test_run();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/test-gplate-utility-functions.c Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,60 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with this library. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +static void
    +gplate_util_test_quoted_string_helper(const gchar *string,
    + const gchar *contents, gboolean value)
    +{
    + gboolean r = FALSE;
    + gchar *c = NULL;
    +
    + r = gplate_util_is_quoted_string(string, &c);
    + g_assert_cmpint(r, ==, value);
    +
    + if(contents)
    + g_assert_cmpstr(c, ==, contents);
    +
    + g_free(c);
    +}
    +
    +static void
    +gplate_util_test_quoted_string(void) {
    + gplate_util_test_quoted_string_helper("\"abc\"", "abc", TRUE);
    + gplate_util_test_quoted_string_helper("\"abc def\"", "abc def", TRUE);
    + gplate_util_test_quoted_string_helper("\"abc\tdef\bghi\"", "abc\tdef\bghi", TRUE);
    + gplate_util_test_quoted_string_helper("abc \"def\"", NULL, FALSE);
    + gplate_util_test_quoted_string_helper("\"abc\" def", NULL, FALSE);
    + gplate_util_test_quoted_string_helper("'abc'", "abc", TRUE);
    + gplate_util_test_quoted_string_helper("'abc def'", "abc def", TRUE);
    + gplate_util_test_quoted_string_helper("'abc\tdef\bghi'", "abc\tdef\bghi", TRUE);
    + gplate_util_test_quoted_string_helper("abc 'def'", NULL, FALSE);
    + gplate_util_test_quoted_string_helper("'abc' def", NULL, FALSE);
    + gplate_util_test_quoted_string_helper("'abc\"", NULL, FALSE);
    + gplate_util_test_quoted_string_helper("\"abc'", NULL, FALSE);
    +}
    +
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + g_test_add_func("/util/quoted_string", gplate_util_test_quoted_string);
    +
    + return g_test_run();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tests/test-gplate-variable-tag.c Mon Sep 03 18:45:07 2012 -0500
    @@ -0,0 +1,237 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with this library. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +#include "test-gplate-tag.h"
    +
    +/******************************************************************************
    + * Helpers
    + *****************************************************************************/
    +static void
    +test_gplate_variable_tag(TestGPlateTagFixture *fixture, gconstpointer data,
    + const gchar *template_string, const gchar *expected,
    + ...)
    +{
    + va_list vargs;
    + const gchar *name = NULL, *value = NULL;
    +
    + va_start(vargs, expected);
    + while((name = va_arg(vargs, const gchar *))) {
    + value = va_arg(vargs, const gchar *);
    +
    + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    + name, value);
    + }
    + va_end(vargs);
    +
    + test_gplate_tag_output(fixture, data, template_string, expected);
    +}
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +static void
    +test_gplate_variable_tag_single(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{ foo }}", "foo",
    + "foo", "foo",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_double(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{ foo }}{{ bar }}", "foobar",
    + "foo", "foo",
    + "bar", "bar",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_tripple(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{ foo }}{{ bar }}{{ baz }}", "foobarbaz",
    + "foo", "foo",
    + "bar", "bar",
    + "baz", "baz",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_newline_prefix(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{\nfoo}}", "foo",
    + "foo", "foo",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_newline_suffix(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{foo\n}}", "foo",
    + "foo", "foo",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_newline_wrapped(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{\nfoo\n}}", "foo",
    + "foo", "foo",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_single_quotes(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "foo '{{ bar }}' baz", "foo 'bar' baz",
    + "bar", "bar",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_double_quotes(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "foo \"{{ bar }}\" baz", "foo \"bar\" baz",
    + "bar", "bar",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_mixed_quotes(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "foo \"{{ bar }}' baz", "foo \"bar' baz",
    + "bar", "bar",
    + NULL);
    +
    + test_gplate_variable_tag(fixture, data,
    + "foo '{{ bar }}\" baz", "foo 'bar\" baz",
    + "bar", "bar",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_two_vars_one_block(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "one {{ two five }} three",
    + "one 2 three",
    + "two", "2",
    + "five", "5",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_nested_single(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + GPlateVariable *dict = gplate_dictionary_variable_new("foo");
    +
    + gplate_collection_add_string(GPLATE_COLLECTION(dict),
    + "bar", "baz");
    +
    + test_gplate_tag_output(fixture, data, "{{ foo.bar }}", "baz");
    +}
    +
    +static void
    +test_gplate_variable_tag_nested_double(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + GPlateVariable *dict1 = gplate_dictionary_variable_new("foo");
    + GPlateVariable *dict2 = gplate_dictionary_variable_new("bar");
    +
    + gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
    + dict1);
    + gplate_collection_add_variable(GPLATE_COLLECTION(dict1), dict2);
    + gplate_collection_add_string(GPLATE_COLLECTION(dict2),
    + "baz", "42");
    +
    + test_gplate_tag_output(fixture, data, "{{ foo.bar.baz }}", "42");
    +}
    +
    +/******************************************************************************
    + * Main
    + *****************************************************************************/
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + g_type_init();
    +
    + gplate_config_load_default();
    +
    + test_gplate_tag_add("/tags/variable/single",
    + test_gplate_variable_tag_single);
    +
    + test_gplate_tag_add("/tags/variable/double",
    + test_gplate_variable_tag_double);
    +
    + test_gplate_tag_add("/tags/variable/tripple",
    + test_gplate_variable_tag_tripple);
    +
    + test_gplate_tag_add("/tags/variable/newline_prefix",
    + test_gplate_variable_tag_newline_prefix);
    +
    + test_gplate_tag_add("/tags/variable/newline_suffix",
    + test_gplate_variable_tag_newline_suffix);
    +
    + test_gplate_tag_add("/tags/variable/newline_wrapped",
    + test_gplate_variable_tag_newline_wrapped);
    +
    + test_gplate_tag_add("/tags/variable/quotes/single",
    + test_gplate_variable_tag_single_quotes);
    +
    + test_gplate_tag_add("/tags/variable/quotes/double",
    + test_gplate_variable_tag_double_quotes);
    +
    + test_gplate_tag_add("/tags/variable/quotes/mixed",
    + test_gplate_variable_tag_mixed_quotes);
    +
    + test_gplate_tag_add("/tags/variable/two_vars_one_block",
    + test_gplate_variable_tag_two_vars_one_block);
    +
    + test_gplate_tag_add("/tags/variables/nested/single",
    + test_gplate_variable_tag_nested_single);
    +
    + test_gplate_tag_add("/tags/variable/nested/double",
    + test_gplate_variable_tag_nested_double);
    +
    + return g_test_run();
    +}
    +