1.1 --- a/gplate/tags/tests/CMakeLists.txt Sun Jul 04 02:02:59 2010 -0500
1.2 +++ b/gplate/tags/tests/CMakeLists.txt Sun Jul 04 02:53:53 2010 -0500
1.3 @@ -9,10 +9,18 @@
1.4 # add the text tag tests
1.5 add_executable(test-text-tag gplate-text-tag-test.c)
1.6 target_link_libraries(test-text-tag gplate-tag-test)
1.7 -add_test(GPlateTextTag test-text-tag)
1.8 +list(APPEND TAG_TESTS test-text-tag)
1.9
1.10 # add the variable tag tests
1.11 add_executable(test-variable-tag gplate-variable-tag-test.c)
1.12 target_link_libraries(test-variable-tag gplate-tag-test)
1.13 -add_test(GPlateVariableTag test-variable-tag)
1.14 +list(APPEND TAG_TESTS test-variable-tag)
1.15
1.16 +# add the comment tag tests
1.17 +add_executable(gplate-comment-tag-test gplate-comment-tag-test.c)
1.18 +target_link_libraries(gplate-comment-tag-test gplate-tag-test)
1.19 +list(APPEND TAG_TESTS gplate-comment-tag-test)
1.20 +
1.21 +# add the tests for gtester
1.22 +add_test(GPlateTagTests ${GTESTER} -k --verbose ${TAG_TESTS})
1.23 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/gplate/tags/tests/gplate-comment-tag-test.c Sun Jul 04 02:53:53 2010 -0500
2.3 @@ -0,0 +1,65 @@
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_comment_tag_test_empty(GPlateTagTestFixture *fixture,
2.15 + gconstpointer data)
2.16 +{
2.17 + gplate_tag_test_output(fixture, data, "{##}", "");
2.18 +}
2.19 +
2.20 +static void
2.21 +gplate_comment_tag_test_whitespace(GPlateTagTestFixture *fixture,
2.22 + gconstpointer data)
2.23 +{
2.24 + gplate_tag_test_output(fixture, data, "{# #}", "");
2.25 + gplate_tag_test_output(fixture, data, "{#\t#}", "");
2.26 + gplate_tag_test_output(fixture, data, "{#\n#}", "");
2.27 + gplate_tag_test_output(fixture, data, "{#\r#}", "");
2.28 + gplate_tag_test_output(fixture, data, "{#\r\n#}", "");
2.29 + gplate_tag_test_output(fixture, data, "{#\n\r#}", "");
2.30 +}
2.31 +
2.32 +static void
2.33 +gplate_comment_tag_test_simple(GPlateTagTestFixture *fixture,
2.34 + gconstpointer data)
2.35 +{
2.36 + gplate_tag_test_output(fixture, data, "{# foo#}", "");
2.37 + gplate_tag_test_output(fixture, data, "{#foo #}", "");
2.38 + gplate_tag_test_output(fixture, data, "{#\tfoo#}", "");
2.39 + gplate_tag_test_output(fixture, data, "{#foo\t#}", "");
2.40 + gplate_tag_test_output(fixture, data, "{#\nfoo#}", "");
2.41 + gplate_tag_test_output(fixture, data, "{#foo\n#}", "");
2.42 + gplate_tag_test_output(fixture, data, "{#\rfoo#}", "");
2.43 + gplate_tag_test_output(fixture, data, "{#foo\r#}", "");
2.44 + gplate_tag_test_output(fixture, data, "{#\r\nfoo#}", "");
2.45 + gplate_tag_test_output(fixture, data, "{#foo\r\n#}", "");
2.46 +}
2.47 +
2.48 +/******************************************************************************
2.49 + * Main
2.50 + *****************************************************************************/
2.51 +gint
2.52 +main(gint argc, gchar **argv) {
2.53 + g_test_init(&argc, &argv, NULL);
2.54 +
2.55 + g_type_init();
2.56 +
2.57 + gplate_config_load_default();
2.58 +
2.59 + gplate_tag_test_add("/tags/comment/empty",
2.60 + gplate_comment_tag_test_empty);
2.61 + gplate_tag_test_add("/tags/comment/whitespace",
2.62 + gplate_comment_tag_test_whitespace);
2.63 + gplate_tag_test_add("/tags/comment/simple",
2.64 + gplate_comment_tag_test_simple);
2.65 +
2.66 + return g_test_run();
2.67 +}
2.68 +