gplate/tags/tests/test-text-tag.c
author Gary Kramlich <grim@reaperworld.com>
Fri Jul 02 02:56:50 2010 -0500 (22 months ago)
changeset 389 8baf0603ff07
parent 387 e9d714deb3a3
permissions -rw-r--r--
Create a sublibrary for the tag testing. I'll probably do this for all components going forward.

Pretty much just reimplemented the tests that were created for check with gtester and ctest
     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_text_tag_test_syntax_plain(GPlateTagTestFixture *fixture,
    12                                   gconstpointer data)
    13 {
    14 	fixture->template_string = "simple template";
    15 	fixture->expected = "simple template";
    16 
    17 	gplate_tag_test_output(fixture, data);
    18 }
    19 
    20 static void
    21 gplate_text_tag_test_syntax_keywords(GPlateTagTestFixture *fixture,
    22                                      gconstpointer data)
    23 {
    24 	fixture->template_string = "extends if else endif for endfor";
    25 	fixture->expected = "extends if else endif for endfor";
    26 
    27 	gplate_tag_test_output(fixture, data);
    28 }
    29 
    30 static void
    31 gplate_text_tag_test_syntax_keywords_case_sensitive(GPlateTagTestFixture *fixture,
    32                                                     gconstpointer data)
    33 {
    34 	fixture->template_string = "EXteNds iF eLse enDif fOr enDFor";
    35 	fixture->expected = "EXteNds iF eLse enDif fOr enDFor";
    36 
    37 	gplate_tag_test_output(fixture, data);
    38 }
    39 
    40 /******************************************************************************
    41  * Main
    42  *****************************************************************************/
    43 gint
    44 main(gint argc, gchar **argv) {
    45 	g_test_init(&argc, &argv, NULL);
    46 
    47 	g_type_init();
    48 
    49 	gplate_config_load_default();
    50 
    51 	gplate_tag_test_add("/tags/text/plain",
    52 	                    gplate_text_tag_test_syntax_plain);
    53 	gplate_tag_test_add("/tags/text/keywords",
    54 	                    gplate_text_tag_test_syntax_keywords);
    55 	gplate_tag_test_add("/tags/text/keywords_case_sensitive", 
    56 	                    gplate_text_tag_test_syntax_keywords_case_sensitive);
    57 
    58 	return g_test_run();
    59 }
    60