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