the start of testing overhaul... Similiar to the main library, all the tests are separated by their function and then statically linked into the main testing executable
--- a/tests/CMakeLists.txt Mon Sep 03 18:45:07 2012 -0500
+++ b/tests/CMakeLists.txt Mon Sep 03 22:33:34 2012 -0500
@@ -1,30 +1,21 @@
- add_executable(${target} ${target}.c)
- target_link_libraries(${target} ${GLIB_LIBRARIES} gplate)
- get_target_property(_output_name ${target} RUNTIME_OUTPUT_NAME)
- get_target_property(_output_name ${target} LOCATION)
+add_executable(test-gplate test-gplate.c) - list(APPEND TESTS ${_output_name})
+target_link_libraries(test-gplate -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}
+ COMMAND ${GTESTER} -k --verbose -o ${GTESTER_LOG} test-gplate --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tags/CMakeLists.txt Mon Sep 03 22:33:34 2012 -0500
@@ -0,0 +1,17 @@
+set(TEST_GPLATE_TAGS_HEADERS +set(TEST_GPLATE_TAGS_SOURCES + test-gplate-comment-tag.c + test-gplate-variable-tag.c +add_library(test-gplate-tags STATIC + ${TEST_GPLATE_TAGS_HEADERS} + ${TEST_GPLATE_TAGS_SOURCES} --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tags/test-gplate-comment-tag.c Mon Sep 03 22:33:34 2012 -0500
@@ -0,0 +1,74 @@
+ * 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 "test-gplate-tag.h" +/****************************************************************************** + *****************************************************************************/ +test_gplate_comment_tag_empty(TestGPlateTagFixture *fixture, + test_gplate_tag_output(fixture, data, "{##}", ""); +test_gplate_comment_tag_whitespace(TestGPlateTagFixture *fixture, + 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#}", ""); +test_gplate_comment_tag_simple(TestGPlateTagFixture *fixture, + 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#}", ""); +/****************************************************************************** + *****************************************************************************/ +test_gplate_comment_tag_add_tests(void) { + 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); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tags/test-gplate-tag.c Mon Sep 03 22:33:34 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 "test-gplate-tag.h" +/****************************************************************************** + *****************************************************************************/ +test_gplate_tag_setup(TestGPlateTagFixture *fixture, gconstpointer data) { + gplate_config_load_default(); + fixture->template = gplate_template_new(); +test_gplate_tag_teardown(TestGPlateTagFixture *fixture, gconstpointer data) { + g_object_unref(fixture->template); + fixture->template = NULL; + g_error_free(fixture->error); + g_free(fixture->actual); + fixture->actual = NULL; +/****************************************************************************** + *****************************************************************************/ +test_gplate_tag_output(TestGPlateTagFixture *fixture, + const gchar *template_string, + fixture->template_string = template_string; + fixture->expected = expected; + fixture->actual = gplate_template_render(fixture->template, + fixture->template_string, + g_assert(fixture->error == NULL); + g_assert_cmpstr(fixture->expected, ==, fixture->actual); +/****************************************************************************** + *****************************************************************************/ +test_gplate_tag_add_tests(void) { + test_gplate_text_tag_add_tests(); + test_gplate_variable_tag_add_tests(); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tags/test-gplate-tag.h Mon Sep 03 22:33:34 2012 -0500
@@ -0,0 +1,58 @@
+ * 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> +#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; + const gchar *template_string; +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); +void test_gplate_tag_add_tests(void); +/* external prototypes */ +void test_gplate_comment_tag_add_tests(void); +void test_gplate_text_tag_add_tests(void); +void test_gplate_variable_tag_add_tests(void); +#endif /* TEST_GPLATE_TAG_H */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tags/test-gplate-text-tag.c Mon Sep 03 22:33:34 2012 -0500
@@ -0,0 +1,63 @@
+ * 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 "test-gplate-tag.h" +/****************************************************************************** + *****************************************************************************/ +test_gplate_text_tag_syntax_plain(TestGPlateTagFixture *fixture, + test_gplate_tag_output(fixture, data, + "simple template", "simple template"); +test_gplate_text_tag_syntax_keywords(TestGPlateTagFixture *fixture, + test_gplate_tag_output(fixture, data, + "extends if else endif for endfor", + "extends if else endif for endfor"); +test_gplate_text_tag_syntax_keywords_case_sensitive(TestGPlateTagFixture *fixture, + test_gplate_tag_output(fixture, data, + "EXteNds iF eLse enDif fOr enDFor", + "EXteNds iF eLse enDif fOr enDFor"); +test_gplate_text_tag_add_tests(void) { + 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); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tags/test-gplate-variable-tag.c Mon Sep 03 22:33:34 2012 -0500
@@ -0,0 +1,229 @@
+ * 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 "test-gplate-tag.h" +/****************************************************************************** + *****************************************************************************/ +test_gplate_variable_tag(TestGPlateTagFixture *fixture, gconstpointer data, + const gchar *template_string, const gchar *expected, + 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), + test_gplate_tag_output(fixture, data, template_string, expected); +/****************************************************************************** + *****************************************************************************/ +test_gplate_variable_tag_single(TestGPlateTagFixture *fixture, + test_gplate_variable_tag(fixture, data, +test_gplate_variable_tag_double(TestGPlateTagFixture *fixture, + test_gplate_variable_tag(fixture, data, + "{{ foo }}{{ bar }}", "foobar", +test_gplate_variable_tag_tripple(TestGPlateTagFixture *fixture, + test_gplate_variable_tag(fixture, data, + "{{ foo }}{{ bar }}{{ baz }}", "foobarbaz", +test_gplate_variable_tag_newline_prefix(TestGPlateTagFixture *fixture, + test_gplate_variable_tag(fixture, data, +test_gplate_variable_tag_newline_suffix(TestGPlateTagFixture *fixture, + test_gplate_variable_tag(fixture, data, +test_gplate_variable_tag_newline_wrapped(TestGPlateTagFixture *fixture, + test_gplate_variable_tag(fixture, data, +test_gplate_variable_tag_single_quotes(TestGPlateTagFixture *fixture, + test_gplate_variable_tag(fixture, data, + "foo '{{ bar }}' baz", "foo 'bar' baz", +test_gplate_variable_tag_double_quotes(TestGPlateTagFixture *fixture, + test_gplate_variable_tag(fixture, data, + "foo \"{{ bar }}\" baz", "foo \"bar\" baz", +test_gplate_variable_tag_mixed_quotes(TestGPlateTagFixture *fixture, + test_gplate_variable_tag(fixture, data, + "foo \"{{ bar }}' baz", "foo \"bar' baz", + test_gplate_variable_tag(fixture, data, + "foo '{{ bar }}\" baz", "foo 'bar\" baz", +test_gplate_variable_tag_two_vars_one_block(TestGPlateTagFixture *fixture, + test_gplate_variable_tag(fixture, data, + "one {{ two five }} three", +test_gplate_variable_tag_nested_single(TestGPlateTagFixture *fixture, + GPlateVariable *dict = gplate_dictionary_variable_new("foo"); + gplate_collection_add_string(GPLATE_COLLECTION(dict), + test_gplate_tag_output(fixture, data, "{{ foo.bar }}", "baz"); +test_gplate_variable_tag_nested_double(TestGPlateTagFixture *fixture, + GPlateVariable *dict1 = gplate_dictionary_variable_new("foo"); + GPlateVariable *dict2 = gplate_dictionary_variable_new("bar"); + gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template), + gplate_collection_add_variable(GPLATE_COLLECTION(dict1), dict2); + gplate_collection_add_string(GPLATE_COLLECTION(dict2), + test_gplate_tag_output(fixture, data, "{{ foo.bar.baz }}", "42"); +/****************************************************************************** + *****************************************************************************/ +test_gplate_variable_tag_add_tests(void) { + 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); --- a/tests/test-gplate-comment-tag.c Mon Sep 03 18:45:07 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 "test-gplate-tag.h"
-/******************************************************************************
- *****************************************************************************/
-test_gplate_comment_tag_empty(TestGPlateTagFixture *fixture,
- test_gplate_tag_output(fixture, data, "{##}", "");
-test_gplate_comment_tag_whitespace(TestGPlateTagFixture *fixture,
- 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#}", "");
-test_gplate_comment_tag_simple(TestGPlateTagFixture *fixture,
- 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 argc, gchar **argv) {
- g_test_init(&argc, &argv, NULL);
- 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);
--- a/tests/test-gplate-tag.c Mon Sep 03 18:45:07 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"
-test_gplate_tag_setup(TestGPlateTagFixture *fixture, gconstpointer data) {
- fixture->template = gplate_template_new();
-test_gplate_tag_teardown(TestGPlateTagFixture *fixture, gconstpointer data) {
- g_object_unref(fixture->template);
- fixture->template = NULL;
- g_error_free(fixture->error);
- g_free(fixture->actual);
- fixture->actual = NULL;
-test_gplate_tag_output(TestGPlateTagFixture *fixture,
- const gchar *template_string,
- fixture->template_string = template_string;
- fixture->expected = expected;
- fixture->actual = gplate_template_render(fixture->template,
- fixture->template_string,
- g_assert(fixture->error == NULL);
- g_assert_cmpstr(fixture->expected, ==, fixture->actual);
--- a/tests/test-gplate-tag.h Mon Sep 03 18:45:07 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>
-#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;
- const gchar *template_string;
-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);
-#endif /* TEST_GPLATE_TAG_H */
--- a/tests/test-gplate-text-tag.c Mon Sep 03 18:45:07 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 "test-gplate-tag.h"
-/******************************************************************************
- *****************************************************************************/
-test_gplate_text_tag_syntax_plain(TestGPlateTagFixture *fixture,
- test_gplate_tag_output(fixture, data,
- "simple template", "simple template");
-test_gplate_text_tag_syntax_keywords(TestGPlateTagFixture *fixture,
- test_gplate_tag_output(fixture, data,
- "extends if else endif for endfor",
- "extends if else endif for endfor");
-test_gplate_text_tag_syntax_keywords_case_sensitive(TestGPlateTagFixture *fixture,
- test_gplate_tag_output(fixture, data,
- "EXteNds iF eLse enDif fOr enDFor",
- "EXteNds iF eLse enDif fOr enDFor");
-/******************************************************************************
- *****************************************************************************/
-main(gint argc, gchar **argv) {
- g_test_init(&argc, &argv, NULL);
- 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);
--- a/tests/test-gplate-variable-tag.c Mon Sep 03 18:45:07 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 "test-gplate-tag.h"
-/******************************************************************************
- *****************************************************************************/
-test_gplate_variable_tag(TestGPlateTagFixture *fixture, gconstpointer data,
- const gchar *template_string, const gchar *expected,
- 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),
- test_gplate_tag_output(fixture, data, template_string, expected);
-/******************************************************************************
- *****************************************************************************/
-test_gplate_variable_tag_single(TestGPlateTagFixture *fixture,
- test_gplate_variable_tag(fixture, data,
-test_gplate_variable_tag_double(TestGPlateTagFixture *fixture,
- test_gplate_variable_tag(fixture, data,
- "{{ foo }}{{ bar }}", "foobar",
-test_gplate_variable_tag_tripple(TestGPlateTagFixture *fixture,
- test_gplate_variable_tag(fixture, data,
- "{{ foo }}{{ bar }}{{ baz }}", "foobarbaz",
-test_gplate_variable_tag_newline_prefix(TestGPlateTagFixture *fixture,
- test_gplate_variable_tag(fixture, data,
-test_gplate_variable_tag_newline_suffix(TestGPlateTagFixture *fixture,
- test_gplate_variable_tag(fixture, data,
-test_gplate_variable_tag_newline_wrapped(TestGPlateTagFixture *fixture,
- test_gplate_variable_tag(fixture, data,
-test_gplate_variable_tag_single_quotes(TestGPlateTagFixture *fixture,
- test_gplate_variable_tag(fixture, data,
- "foo '{{ bar }}' baz", "foo 'bar' baz",
-test_gplate_variable_tag_double_quotes(TestGPlateTagFixture *fixture,
- test_gplate_variable_tag(fixture, data,
- "foo \"{{ bar }}\" baz", "foo \"bar\" baz",
-test_gplate_variable_tag_mixed_quotes(TestGPlateTagFixture *fixture,
- test_gplate_variable_tag(fixture, data,
- "foo \"{{ bar }}' baz", "foo \"bar' baz",
- test_gplate_variable_tag(fixture, data,
- "foo '{{ bar }}\" baz", "foo 'bar\" baz",
-test_gplate_variable_tag_two_vars_one_block(TestGPlateTagFixture *fixture,
- test_gplate_variable_tag(fixture, data,
- "one {{ two five }} three",
-test_gplate_variable_tag_nested_single(TestGPlateTagFixture *fixture,
- GPlateVariable *dict = gplate_dictionary_variable_new("foo");
- gplate_collection_add_string(GPLATE_COLLECTION(dict),
- test_gplate_tag_output(fixture, data, "{{ foo.bar }}", "baz");
-test_gplate_variable_tag_nested_double(TestGPlateTagFixture *fixture,
- GPlateVariable *dict1 = gplate_dictionary_variable_new("foo");
- GPlateVariable *dict2 = gplate_dictionary_variable_new("bar");
- gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
- gplate_collection_add_variable(GPLATE_COLLECTION(dict1), dict2);
- gplate_collection_add_string(GPLATE_COLLECTION(dict2),
- test_gplate_tag_output(fixture, data, "{{ foo.bar.baz }}", "42");
-/******************************************************************************
- *****************************************************************************/
-main(gint argc, gchar **argv) {
- g_test_init(&argc, &argv, NULL);
- 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);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-gplate.c Mon Sep 03 22:33:34 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 "tags/test-gplate-tag.h" +main(gint argc, gchar **argv) { + g_test_init(&argc, &argv, NULL); + test_gplate_tag_add_tests();