gplate/tags/tests/gplate-comment-tag-test.c
author Gary Kramlich <grim@reaperworld.com>
Sun Jul 04 02:53:53 2010 -0500 (22 months ago)
changeset 396 2771744219bd
permissions -rw-r--r--
Added the tests for comment tags
     1 #include <gplate/gplate.h>
     2 
     3 #include <glib.h>
     4 
     5 #include "gplate-tag-test.h"
     6 
     7 /******************************************************************************
     8  * Tests
     9  *****************************************************************************/
    10 static void
    11 gplate_comment_tag_test_empty(GPlateTagTestFixture *fixture,
    12                               gconstpointer data)
    13 {
    14 	gplate_tag_test_output(fixture, data, "{##}", "");
    15 }
    16 
    17 static void
    18 gplate_comment_tag_test_whitespace(GPlateTagTestFixture *fixture,
    19                                    gconstpointer data)
    20 {
    21 	gplate_tag_test_output(fixture, data, "{# #}", "");
    22 	gplate_tag_test_output(fixture, data, "{#\t#}", "");
    23 	gplate_tag_test_output(fixture, data, "{#\n#}", "");
    24 	gplate_tag_test_output(fixture, data, "{#\r#}", "");
    25 	gplate_tag_test_output(fixture, data, "{#\r\n#}", "");
    26 	gplate_tag_test_output(fixture, data, "{#\n\r#}", "");
    27 }
    28 
    29 static void
    30 gplate_comment_tag_test_simple(GPlateTagTestFixture *fixture,
    31                                gconstpointer data)
    32 {
    33 	gplate_tag_test_output(fixture, data, "{# foo#}", "");
    34 	gplate_tag_test_output(fixture, data, "{#foo #}", "");
    35 	gplate_tag_test_output(fixture, data, "{#\tfoo#}", "");
    36 	gplate_tag_test_output(fixture, data, "{#foo\t#}", "");
    37 	gplate_tag_test_output(fixture, data, "{#\nfoo#}", "");
    38 	gplate_tag_test_output(fixture, data, "{#foo\n#}", "");
    39 	gplate_tag_test_output(fixture, data, "{#\rfoo#}", "");
    40 	gplate_tag_test_output(fixture, data, "{#foo\r#}", "");
    41 	gplate_tag_test_output(fixture, data, "{#\r\nfoo#}", "");
    42 	gplate_tag_test_output(fixture, data, "{#foo\r\n#}", "");
    43 }
    44 
    45 /******************************************************************************
    46  * Main
    47  *****************************************************************************/
    48 gint
    49 main(gint argc, gchar **argv) {
    50 	g_test_init(&argc, &argv, NULL);
    51 
    52 	g_type_init();
    53 
    54 	gplate_config_load_default();
    55 
    56 	gplate_tag_test_add("/tags/comment/empty",
    57 	                    gplate_comment_tag_test_empty);
    58 	gplate_tag_test_add("/tags/comment/whitespace",
    59 	                    gplate_comment_tag_test_whitespace);
    60 	gplate_tag_test_add("/tags/comment/simple",
    61 	                    gplate_comment_tag_test_simple);
    62 
    63 	return g_test_run();
    64 }
    65