1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/gplate/tags/tests/test-gplate-comment-tag.c Sun Jul 04 03:34:39 2010 -0500
1.3 @@ -0,0 +1,81 @@
1.4 +/*
1.5 + * Copyright (C) 2007-2010 Gary Kramlich <grim@reaperworld.com>
1.6 + *
1.7 + * This program is free software: you can redistribute it and/or modify
1.8 + * it under the terms of the GNU General Public License as published by
1.9 + * the Free Software Foundation, either version 3 of the License, or
1.10 + * (at your option) any later version.
1.11 + *
1.12 + * This program is distributed in the hope that it will be useful,
1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.15 + * GNU General Public License for more details.
1.16 + *
1.17 + * You should have received a copy of the GNU General Public License
1.18 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
1.19 + */
1.20 +#include <gplate/gplate.h>
1.21 +
1.22 +#include <glib.h>
1.23 +
1.24 +#include "test-gplate-tag.h"
1.25 +
1.26 +/******************************************************************************
1.27 + * Tests
1.28 + *****************************************************************************/
1.29 +static void
1.30 +test_gplate_comment_tag_empty(TestGPlateTagFixture *fixture,
1.31 + gconstpointer data)
1.32 +{
1.33 + test_gplate_tag_output(fixture, data, "{##}", "");
1.34 +}
1.35 +
1.36 +static void
1.37 +test_gplate_comment_tag_whitespace(TestGPlateTagFixture *fixture,
1.38 + gconstpointer data)
1.39 +{
1.40 + test_gplate_tag_output(fixture, data, "{# #}", "");
1.41 + test_gplate_tag_output(fixture, data, "{#\t#}", "");
1.42 + test_gplate_tag_output(fixture, data, "{#\n#}", "");
1.43 + test_gplate_tag_output(fixture, data, "{#\r#}", "");
1.44 + test_gplate_tag_output(fixture, data, "{#\r\n#}", "");
1.45 + test_gplate_tag_output(fixture, data, "{#\n\r#}", "");
1.46 +}
1.47 +
1.48 +static void
1.49 +test_gplate_comment_tag_simple(TestGPlateTagFixture *fixture,
1.50 + gconstpointer data)
1.51 +{
1.52 + test_gplate_tag_output(fixture, data, "{# foo#}", "");
1.53 + test_gplate_tag_output(fixture, data, "{#foo #}", "");
1.54 + test_gplate_tag_output(fixture, data, "{#\tfoo#}", "");
1.55 + test_gplate_tag_output(fixture, data, "{#foo\t#}", "");
1.56 + test_gplate_tag_output(fixture, data, "{#\nfoo#}", "");
1.57 + test_gplate_tag_output(fixture, data, "{#foo\n#}", "");
1.58 + test_gplate_tag_output(fixture, data, "{#\rfoo#}", "");
1.59 + test_gplate_tag_output(fixture, data, "{#foo\r#}", "");
1.60 + test_gplate_tag_output(fixture, data, "{#\r\nfoo#}", "");
1.61 + test_gplate_tag_output(fixture, data, "{#foo\r\n#}", "");
1.62 +}
1.63 +
1.64 +/******************************************************************************
1.65 + * Main
1.66 + *****************************************************************************/
1.67 +gint
1.68 +main(gint argc, gchar **argv) {
1.69 + g_test_init(&argc, &argv, NULL);
1.70 +
1.71 + g_type_init();
1.72 +
1.73 + gplate_config_load_default();
1.74 +
1.75 + test_gplate_tag_add("/tags/comment/empty",
1.76 + test_gplate_comment_tag_empty);
1.77 + test_gplate_tag_add("/tags/comment/whitespace",
1.78 + test_gplate_comment_tag_whitespace);
1.79 + test_gplate_tag_add("/tags/comment/simple",
1.80 + test_gplate_comment_tag_simple);
1.81 +
1.82 + return g_test_run();
1.83 +}
1.84 +