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
grim@386
     1
#include <gplate/gplate.h>
grim@386
     2
grim@386
     3
#include <glib.h>
grim@386
     4
grim@389
     5
#include "gplate-tag-test.h"
grim@386
     6
grim@386
     7
/******************************************************************************
grim@386
     8
 * Tests
grim@386
     9
 *****************************************************************************/
grim@386
    10
static void
grim@389
    11
gplate_text_tag_test_syntax_plain(GPlateTagTestFixture *fixture,
grim@389
    12
                                  gconstpointer data)
grim@386
    13
{
grim@386
    14
	fixture->template_string = "simple template";
grim@386
    15
	fixture->expected = "simple template";
grim@386
    16
grim@389
    17
	gplate_tag_test_output(fixture, data);
grim@386
    18
}
grim@386
    19
grim@387
    20
static void
grim@389
    21
gplate_text_tag_test_syntax_keywords(GPlateTagTestFixture *fixture,
grim@389
    22
                                     gconstpointer data)
grim@387
    23
{
grim@387
    24
	fixture->template_string = "extends if else endif for endfor";
grim@387
    25
	fixture->expected = "extends if else endif for endfor";
grim@387
    26
grim@389
    27
	gplate_tag_test_output(fixture, data);
grim@387
    28
}
grim@387
    29
grim@387
    30
static void
grim@389
    31
gplate_text_tag_test_syntax_keywords_case_sensitive(GPlateTagTestFixture *fixture,
grim@389
    32
                                                    gconstpointer data)
grim@387
    33
{
grim@387
    34
	fixture->template_string = "EXteNds iF eLse enDif fOr enDFor";
grim@387
    35
	fixture->expected = "EXteNds iF eLse enDif fOr enDFor";
grim@387
    36
grim@389
    37
	gplate_tag_test_output(fixture, data);
grim@387
    38
}
grim@387
    39
grim@386
    40
/******************************************************************************
grim@386
    41
 * Main
grim@386
    42
 *****************************************************************************/
grim@386
    43
gint
grim@386
    44
main(gint argc, gchar **argv) {
grim@386
    45
	g_test_init(&argc, &argv, NULL);
grim@386
    46
grim@386
    47
	g_type_init();
grim@386
    48
grim@386
    49
	gplate_config_load_default();
grim@386
    50
grim@389
    51
	gplate_tag_test_add("/tags/text/plain",
grim@389
    52
	                    gplate_text_tag_test_syntax_plain);
grim@389
    53
	gplate_tag_test_add("/tags/text/keywords",
grim@389
    54
	                    gplate_text_tag_test_syntax_keywords);
grim@389
    55
	gplate_tag_test_add("/tags/text/keywords_case_sensitive", 
grim@389
    56
	                    gplate_text_tag_test_syntax_keywords_case_sensitive);
grim@387
    57
grim@386
    58
	return g_test_run();
grim@386
    59
}
grim@386
    60