1.1 --- a/gplate/tags/tests/CMakeLists.txt Fri Jul 02 02:57:50 2010 -0500
1.2 +++ b/gplate/tags/tests/CMakeLists.txt Fri Jul 02 03:00:15 2010 -0500
1.3 @@ -7,12 +7,12 @@
1.4 target_link_libraries(gplate-tag-test gplate)
1.5
1.6 # add the text tag tests
1.7 -add_executable(test-text-tag test-text-tag.c)
1.8 +add_executable(test-text-tag gplate-text-tag-test.c)
1.9 target_link_libraries(test-text-tag gplate-tag-test)
1.10 add_test(GPlateTextTag test-text-tag)
1.11
1.12 # add the variable tag tests
1.13 -add_executable(test-variable-tag test-variable-tag.c)
1.14 +add_executable(test-variable-tag gplate-variable-tag-test.c)
1.15 target_link_libraries(test-variable-tag gplate-tag-test)
1.16 add_test(GPlateVariableTag test-variable-tag)
1.17
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/gplate/tags/tests/gplate-text-tag-test.c Fri Jul 02 03:00:15 2010 -0500
2.3 @@ -0,0 +1,60 @@
2.4 +#include <gplate/gplate.h>
2.5 +
2.6 +#include <glib.h>
2.7 +
2.8 +#include "gplate-tag-test.h"
2.9 +
2.10 +/******************************************************************************
2.11 + * Tests
2.12 + *****************************************************************************/
2.13 +static void
2.14 +gplate_text_tag_test_syntax_plain(GPlateTagTestFixture *fixture,
2.15 + gconstpointer data)
2.16 +{
2.17 + fixture->template_string = "simple template";
2.18 + fixture->expected = "simple template";
2.19 +
2.20 + gplate_tag_test_output(fixture, data);
2.21 +}
2.22 +
2.23 +static void
2.24 +gplate_text_tag_test_syntax_keywords(GPlateTagTestFixture *fixture,
2.25 + gconstpointer data)
2.26 +{
2.27 + fixture->template_string = "extends if else endif for endfor";
2.28 + fixture->expected = "extends if else endif for endfor";
2.29 +
2.30 + gplate_tag_test_output(fixture, data);
2.31 +}
2.32 +
2.33 +static void
2.34 +gplate_text_tag_test_syntax_keywords_case_sensitive(GPlateTagTestFixture *fixture,
2.35 + gconstpointer data)
2.36 +{
2.37 + fixture->template_string = "EXteNds iF eLse enDif fOr enDFor";
2.38 + fixture->expected = "EXteNds iF eLse enDif fOr enDFor";
2.39 +
2.40 + gplate_tag_test_output(fixture, data);
2.41 +}
2.42 +
2.43 +/******************************************************************************
2.44 + * Main
2.45 + *****************************************************************************/
2.46 +gint
2.47 +main(gint argc, gchar **argv) {
2.48 + g_test_init(&argc, &argv, NULL);
2.49 +
2.50 + g_type_init();
2.51 +
2.52 + gplate_config_load_default();
2.53 +
2.54 + gplate_tag_test_add("/tags/text/plain",
2.55 + gplate_text_tag_test_syntax_plain);
2.56 + gplate_tag_test_add("/tags/text/keywords",
2.57 + gplate_text_tag_test_syntax_keywords);
2.58 + gplate_tag_test_add("/tags/text/keywords_case_sensitive",
2.59 + gplate_text_tag_test_syntax_keywords_case_sensitive);
2.60 +
2.61 + return g_test_run();
2.62 +}
2.63 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/gplate/tags/tests/gplate-variable-tag-test.c Fri Jul 02 03:00:15 2010 -0500
3.3 @@ -0,0 +1,125 @@
3.4 +#include <gplate/gplate.h>
3.5 +
3.6 +#include <glib.h>
3.7 +
3.8 +#include "gplate-tag-test.h"
3.9 +
3.10 +/******************************************************************************
3.11 + * Tests
3.12 + *****************************************************************************/
3.13 +static void
3.14 +gplate_variable_tag_test_single(GPlateTagTestFixture *fixture,
3.15 + gconstpointer data)
3.16 +{
3.17 + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
3.18 + "foo", "bar");
3.19 +
3.20 + fixture->template_string = "{{ foo }}";
3.21 + fixture->expected = "bar";
3.22 +
3.23 + gplate_tag_test_output(fixture, data);
3.24 +}
3.25 +
3.26 +static void
3.27 +gplate_variable_tag_test_double(GPlateTagTestFixture *fixture,
3.28 + gconstpointer data)
3.29 +{
3.30 + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
3.31 + "foo", "foo");
3.32 + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
3.33 + "bar", "bar");
3.34 +
3.35 + fixture->template_string = "{{ foo }}{{ bar }}";
3.36 + fixture->expected = "foobar";
3.37 +
3.38 + gplate_tag_test_output(fixture, data);
3.39 +}
3.40 +
3.41 +static void
3.42 +gplate_variable_tag_test_tripple(GPlateTagTestFixture *fixture,
3.43 + gconstpointer data)
3.44 +{
3.45 + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
3.46 + "foo", "foo");
3.47 + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
3.48 + "bar", "bar");
3.49 + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
3.50 + "baz", "baz");
3.51 +
3.52 + fixture->template_string = "{{ foo }}{{ bar }}{{ baz }}";
3.53 + fixture->expected = "foobarbaz";
3.54 +
3.55 + gplate_tag_test_output(fixture, data);
3.56 +}
3.57 +
3.58 +static void
3.59 +gplate_variable_tag_test_newline_prefix(GPlateTagTestFixture *fixture,
3.60 + gconstpointer data)
3.61 +{
3.62 + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
3.63 + "foo", "bar");
3.64 +
3.65 + fixture->template_string = "{{\nfoo}}";
3.66 + fixture->expected = "bar";
3.67 +
3.68 + gplate_tag_test_output(fixture, data);
3.69 +}
3.70 +
3.71 +static void
3.72 +gplate_variable_tag_test_newline_suffix(GPlateTagTestFixture *fixture,
3.73 + gconstpointer data)
3.74 +{
3.75 + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
3.76 + "foo", "bar");
3.77 +
3.78 + fixture->template_string = "{{foo\n}}";
3.79 + fixture->expected = "bar";
3.80 +
3.81 + gplate_tag_test_output(fixture, data);
3.82 +}
3.83 +
3.84 +static void
3.85 +gplate_variable_tag_test_newline_wrapped(GPlateTagTestFixture *fixture,
3.86 + gconstpointer data)
3.87 +{
3.88 + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
3.89 + "foo", "bar");
3.90 +
3.91 + fixture->template_string = "{{\nfoo\n}}";
3.92 + fixture->expected = "bar";
3.93 +
3.94 + gplate_tag_test_output(fixture, data);
3.95 +}
3.96 +
3.97 +/******************************************************************************
3.98 + * Main
3.99 + *****************************************************************************/
3.100 +gint
3.101 +main(gint argc, gchar **argv) {
3.102 + g_test_init(&argc, &argv, NULL);
3.103 +
3.104 + g_type_init();
3.105 +
3.106 + gplate_config_load_default();
3.107 +
3.108 + gplate_tag_test_add("/tags/variable/single",
3.109 + gplate_variable_tag_test_single);
3.110 +
3.111 + gplate_tag_test_add("/tags/variable/double",
3.112 + gplate_variable_tag_test_double);
3.113 +
3.114 + gplate_tag_test_add("/tags/variable/tripple",
3.115 + gplate_variable_tag_test_tripple);
3.116 +
3.117 + gplate_tag_test_add("/tags/variable/newline_prefix",
3.118 + gplate_variable_tag_test_newline_prefix);
3.119 +
3.120 + gplate_tag_test_add("/tags/variable/newline_suffix",
3.121 + gplate_variable_tag_test_newline_suffix);
3.122 +
3.123 + gplate_tag_test_add("/tags/variable/newline_wrapped",
3.124 + gplate_variable_tag_test_newline_wrapped);
3.125 +
3.126 + return g_test_run();
3.127 +}
3.128 +
4.1 --- a/gplate/tags/tests/test-text-tag.c Fri Jul 02 02:57:50 2010 -0500
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,60 +0,0 @@
4.4 -#include <gplate/gplate.h>
4.5 -
4.6 -#include <glib.h>
4.7 -
4.8 -#include "gplate-tag-test.h"
4.9 -
4.10 -/******************************************************************************
4.11 - * Tests
4.12 - *****************************************************************************/
4.13 -static void
4.14 -gplate_text_tag_test_syntax_plain(GPlateTagTestFixture *fixture,
4.15 - gconstpointer data)
4.16 -{
4.17 - fixture->template_string = "simple template";
4.18 - fixture->expected = "simple template";
4.19 -
4.20 - gplate_tag_test_output(fixture, data);
4.21 -}
4.22 -
4.23 -static void
4.24 -gplate_text_tag_test_syntax_keywords(GPlateTagTestFixture *fixture,
4.25 - gconstpointer data)
4.26 -{
4.27 - fixture->template_string = "extends if else endif for endfor";
4.28 - fixture->expected = "extends if else endif for endfor";
4.29 -
4.30 - gplate_tag_test_output(fixture, data);
4.31 -}
4.32 -
4.33 -static void
4.34 -gplate_text_tag_test_syntax_keywords_case_sensitive(GPlateTagTestFixture *fixture,
4.35 - gconstpointer data)
4.36 -{
4.37 - fixture->template_string = "EXteNds iF eLse enDif fOr enDFor";
4.38 - fixture->expected = "EXteNds iF eLse enDif fOr enDFor";
4.39 -
4.40 - gplate_tag_test_output(fixture, data);
4.41 -}
4.42 -
4.43 -/******************************************************************************
4.44 - * Main
4.45 - *****************************************************************************/
4.46 -gint
4.47 -main(gint argc, gchar **argv) {
4.48 - g_test_init(&argc, &argv, NULL);
4.49 -
4.50 - g_type_init();
4.51 -
4.52 - gplate_config_load_default();
4.53 -
4.54 - gplate_tag_test_add("/tags/text/plain",
4.55 - gplate_text_tag_test_syntax_plain);
4.56 - gplate_tag_test_add("/tags/text/keywords",
4.57 - gplate_text_tag_test_syntax_keywords);
4.58 - gplate_tag_test_add("/tags/text/keywords_case_sensitive",
4.59 - gplate_text_tag_test_syntax_keywords_case_sensitive);
4.60 -
4.61 - return g_test_run();
4.62 -}
4.63 -
5.1 --- a/gplate/tags/tests/test-variable-tag.c Fri Jul 02 02:57:50 2010 -0500
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,125 +0,0 @@
5.4 -#include <gplate/gplate.h>
5.5 -
5.6 -#include <glib.h>
5.7 -
5.8 -#include "gplate-tag-test.h"
5.9 -
5.10 -/******************************************************************************
5.11 - * Tests
5.12 - *****************************************************************************/
5.13 -static void
5.14 -gplate_variable_tag_test_single(GPlateTagTestFixture *fixture,
5.15 - gconstpointer data)
5.16 -{
5.17 - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
5.18 - "foo", "bar");
5.19 -
5.20 - fixture->template_string = "{{ foo }}";
5.21 - fixture->expected = "bar";
5.22 -
5.23 - gplate_tag_test_output(fixture, data);
5.24 -}
5.25 -
5.26 -static void
5.27 -gplate_variable_tag_test_double(GPlateTagTestFixture *fixture,
5.28 - gconstpointer data)
5.29 -{
5.30 - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
5.31 - "foo", "foo");
5.32 - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
5.33 - "bar", "bar");
5.34 -
5.35 - fixture->template_string = "{{ foo }}{{ bar }}";
5.36 - fixture->expected = "foobar";
5.37 -
5.38 - gplate_tag_test_output(fixture, data);
5.39 -}
5.40 -
5.41 -static void
5.42 -gplate_variable_tag_test_tripple(GPlateTagTestFixture *fixture,
5.43 - gconstpointer data)
5.44 -{
5.45 - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
5.46 - "foo", "foo");
5.47 - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
5.48 - "bar", "bar");
5.49 - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
5.50 - "baz", "baz");
5.51 -
5.52 - fixture->template_string = "{{ foo }}{{ bar }}{{ baz }}";
5.53 - fixture->expected = "foobarbaz";
5.54 -
5.55 - gplate_tag_test_output(fixture, data);
5.56 -}
5.57 -
5.58 -static void
5.59 -gplate_variable_tag_test_newline_prefix(GPlateTagTestFixture *fixture,
5.60 - gconstpointer data)
5.61 -{
5.62 - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
5.63 - "foo", "bar");
5.64 -
5.65 - fixture->template_string = "{{\nfoo}}";
5.66 - fixture->expected = "bar";
5.67 -
5.68 - gplate_tag_test_output(fixture, data);
5.69 -}
5.70 -
5.71 -static void
5.72 -gplate_variable_tag_test_newline_suffix(GPlateTagTestFixture *fixture,
5.73 - gconstpointer data)
5.74 -{
5.75 - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
5.76 - "foo", "bar");
5.77 -
5.78 - fixture->template_string = "{{foo\n}}";
5.79 - fixture->expected = "bar";
5.80 -
5.81 - gplate_tag_test_output(fixture, data);
5.82 -}
5.83 -
5.84 -static void
5.85 -gplate_variable_tag_test_newline_wrapped(GPlateTagTestFixture *fixture,
5.86 - gconstpointer data)
5.87 -{
5.88 - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
5.89 - "foo", "bar");
5.90 -
5.91 - fixture->template_string = "{{\nfoo\n}}";
5.92 - fixture->expected = "bar";
5.93 -
5.94 - gplate_tag_test_output(fixture, data);
5.95 -}
5.96 -
5.97 -/******************************************************************************
5.98 - * Main
5.99 - *****************************************************************************/
5.100 -gint
5.101 -main(gint argc, gchar **argv) {
5.102 - g_test_init(&argc, &argv, NULL);
5.103 -
5.104 - g_type_init();
5.105 -
5.106 - gplate_config_load_default();
5.107 -
5.108 - gplate_tag_test_add("/tags/variable/single",
5.109 - gplate_variable_tag_test_single);
5.110 -
5.111 - gplate_tag_test_add("/tags/variable/double",
5.112 - gplate_variable_tag_test_double);
5.113 -
5.114 - gplate_tag_test_add("/tags/variable/tripple",
5.115 - gplate_variable_tag_test_tripple);
5.116 -
5.117 - gplate_tag_test_add("/tags/variable/newline_prefix",
5.118 - gplate_variable_tag_test_newline_prefix);
5.119 -
5.120 - gplate_tag_test_add("/tags/variable/newline_suffix",
5.121 - gplate_variable_tag_test_newline_suffix);
5.122 -
5.123 - gplate_tag_test_add("/tags/variable/newline_wrapped",
5.124 - gplate_variable_tag_test_newline_wrapped);
5.125 -
5.126 - return g_test_run();
5.127 -}
5.128 -