gplate/tags/tests/gplate-comment-tag-test.c
changeset 396 2771744219bd
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gplate/tags/tests/gplate-comment-tag-test.c	Sun Jul 04 02:53:53 2010 -0500
     1.3 @@ -0,0 +1,65 @@
     1.4 +#include <gplate/gplate.h>
     1.5 +
     1.6 +#include <glib.h>
     1.7 +
     1.8 +#include "gplate-tag-test.h"
     1.9 +
    1.10 +/******************************************************************************
    1.11 + * Tests
    1.12 + *****************************************************************************/
    1.13 +static void
    1.14 +gplate_comment_tag_test_empty(GPlateTagTestFixture *fixture,
    1.15 +                              gconstpointer data)
    1.16 +{
    1.17 +	gplate_tag_test_output(fixture, data, "{##}", "");
    1.18 +}
    1.19 +
    1.20 +static void
    1.21 +gplate_comment_tag_test_whitespace(GPlateTagTestFixture *fixture,
    1.22 +                                   gconstpointer data)
    1.23 +{
    1.24 +	gplate_tag_test_output(fixture, data, "{# #}", "");
    1.25 +	gplate_tag_test_output(fixture, data, "{#\t#}", "");
    1.26 +	gplate_tag_test_output(fixture, data, "{#\n#}", "");
    1.27 +	gplate_tag_test_output(fixture, data, "{#\r#}", "");
    1.28 +	gplate_tag_test_output(fixture, data, "{#\r\n#}", "");
    1.29 +	gplate_tag_test_output(fixture, data, "{#\n\r#}", "");
    1.30 +}
    1.31 +
    1.32 +static void
    1.33 +gplate_comment_tag_test_simple(GPlateTagTestFixture *fixture,
    1.34 +                               gconstpointer data)
    1.35 +{
    1.36 +	gplate_tag_test_output(fixture, data, "{# foo#}", "");
    1.37 +	gplate_tag_test_output(fixture, data, "{#foo #}", "");
    1.38 +	gplate_tag_test_output(fixture, data, "{#\tfoo#}", "");
    1.39 +	gplate_tag_test_output(fixture, data, "{#foo\t#}", "");
    1.40 +	gplate_tag_test_output(fixture, data, "{#\nfoo#}", "");
    1.41 +	gplate_tag_test_output(fixture, data, "{#foo\n#}", "");
    1.42 +	gplate_tag_test_output(fixture, data, "{#\rfoo#}", "");
    1.43 +	gplate_tag_test_output(fixture, data, "{#foo\r#}", "");
    1.44 +	gplate_tag_test_output(fixture, data, "{#\r\nfoo#}", "");
    1.45 +	gplate_tag_test_output(fixture, data, "{#foo\r\n#}", "");
    1.46 +}
    1.47 +
    1.48 +/******************************************************************************
    1.49 + * Main
    1.50 + *****************************************************************************/
    1.51 +gint
    1.52 +main(gint argc, gchar **argv) {
    1.53 +	g_test_init(&argc, &argv, NULL);
    1.54 +
    1.55 +	g_type_init();
    1.56 +
    1.57 +	gplate_config_load_default();
    1.58 +
    1.59 +	gplate_tag_test_add("/tags/comment/empty",
    1.60 +	                    gplate_comment_tag_test_empty);
    1.61 +	gplate_tag_test_add("/tags/comment/whitespace",
    1.62 +	                    gplate_comment_tag_test_whitespace);
    1.63 +	gplate_tag_test_add("/tags/comment/simple",
    1.64 +	                    gplate_comment_tag_test_simple);
    1.65 +
    1.66 +	return g_test_run();
    1.67 +}
    1.68 +