gplate/tags/tests/gplate-text-tag-test.c
author Gary Kramlich <grim@reaperworld.com>
Sat Jul 03 23:24:33 2010 -0500 (22 months ago)
changeset 394 ad26d98e20e6
parent 391 20d032b30b6a
child 395 2a257237a0ef
permissions -rw-r--r--
Changed the license from gplv2 to gplv3
Updated copyrights to be 2007-2010 rather than 2007-2008 (since just about everything has been touched recently
Ignored the top level tests/ directory for now since that is slowly being replaced
     1 /*
     2  * Copyright (C) 2007-2010 Gary Kramlich <grim@reaperworld.com>
     3  *
     4  * This program is free software: you can redistribute it and/or modify
     5  * it under the terms of the GNU General Public License as published by
     6  * the Free Software Foundation, either version 3 of the License, or
     7  * (at your option) any later version.
     8  *
     9  * This program is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * GNU General Public License for more details.
    13  *
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    16  */
    17 #include <gplate/gplate.h>
    18 
    19 #include <glib.h>
    20 
    21 #include "gplate-tag-test.h"
    22 
    23 /******************************************************************************
    24  * Tests
    25  *****************************************************************************/
    26 static void
    27 gplate_text_tag_test_syntax_plain(GPlateTagTestFixture *fixture,
    28                                   gconstpointer data)
    29 {
    30 	fixture->template_string = "simple template";
    31 	fixture->expected = "simple template";
    32 
    33 	gplate_tag_test_output(fixture, data);
    34 }
    35 
    36 static void
    37 gplate_text_tag_test_syntax_keywords(GPlateTagTestFixture *fixture,
    38                                      gconstpointer data)
    39 {
    40 	fixture->template_string = "extends if else endif for endfor";
    41 	fixture->expected = "extends if else endif for endfor";
    42 
    43 	gplate_tag_test_output(fixture, data);
    44 }
    45 
    46 static void
    47 gplate_text_tag_test_syntax_keywords_case_sensitive(GPlateTagTestFixture *fixture,
    48                                                     gconstpointer data)
    49 {
    50 	fixture->template_string = "EXteNds iF eLse enDif fOr enDFor";
    51 	fixture->expected = "EXteNds iF eLse enDif fOr enDFor";
    52 
    53 	gplate_tag_test_output(fixture, data);
    54 }
    55 
    56 /******************************************************************************
    57  * Main
    58  *****************************************************************************/
    59 gint
    60 main(gint argc, gchar **argv) {
    61 	g_test_init(&argc, &argv, NULL);
    62 
    63 	g_type_init();
    64 
    65 	gplate_config_load_default();
    66 
    67 	gplate_tag_test_add("/tags/text/plain",
    68 	                    gplate_text_tag_test_syntax_plain);
    69 	gplate_tag_test_add("/tags/text/keywords",
    70 	                    gplate_text_tag_test_syntax_keywords);
    71 	gplate_tag_test_add("/tags/text/keywords_case_sensitive", 
    72 	                    gplate_text_tag_test_syntax_keywords_case_sensitive);
    73 
    74 	return g_test_run();
    75 }
    76