gplate/tags/tests/test-variable-tag.c
changeset 391 20d032b30b6a
parent 390 3a38d5cf4abd
child 392 27f9b7952d63
     1.1 --- a/gplate/tags/tests/test-variable-tag.c	Fri Jul 02 02:57:50 2010 -0500
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,125 +0,0 @@
     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_variable_tag_test_single(GPlateTagTestFixture *fixture,
    1.15 -                                gconstpointer data)
    1.16 -{
    1.17 -	gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    1.18 -	                             "foo", "bar");
    1.19 -
    1.20 -	fixture->template_string = "{{ foo }}";
    1.21 -	fixture->expected = "bar";
    1.22 -
    1.23 -	gplate_tag_test_output(fixture, data);
    1.24 -}
    1.25 -
    1.26 -static void
    1.27 -gplate_variable_tag_test_double(GPlateTagTestFixture *fixture,
    1.28 -                                gconstpointer data)
    1.29 -{
    1.30 -	gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    1.31 -	                             "foo", "foo");
    1.32 -	gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    1.33 -	                             "bar", "bar");
    1.34 -
    1.35 -	fixture->template_string = "{{ foo }}{{ bar }}";
    1.36 -	fixture->expected = "foobar";
    1.37 -
    1.38 -	gplate_tag_test_output(fixture, data);
    1.39 -}
    1.40 -
    1.41 -static void
    1.42 -gplate_variable_tag_test_tripple(GPlateTagTestFixture *fixture,
    1.43 -                                 gconstpointer data)
    1.44 -{
    1.45 -	gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    1.46 -	                             "foo", "foo");
    1.47 -	gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    1.48 -	                             "bar", "bar");
    1.49 -	gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    1.50 -	                             "baz", "baz");
    1.51 -
    1.52 -	fixture->template_string = "{{ foo }}{{ bar }}{{ baz }}";
    1.53 -	fixture->expected = "foobarbaz";
    1.54 -
    1.55 -	gplate_tag_test_output(fixture, data);
    1.56 -}
    1.57 -
    1.58 -static void
    1.59 -gplate_variable_tag_test_newline_prefix(GPlateTagTestFixture *fixture,
    1.60 -                                        gconstpointer data)
    1.61 -{
    1.62 -	gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    1.63 -	                             "foo", "bar");
    1.64 -
    1.65 -	fixture->template_string = "{{\nfoo}}";
    1.66 -	fixture->expected = "bar";
    1.67 -
    1.68 -	gplate_tag_test_output(fixture, data);
    1.69 -}
    1.70 -
    1.71 -static void
    1.72 -gplate_variable_tag_test_newline_suffix(GPlateTagTestFixture *fixture,
    1.73 -                                        gconstpointer data)
    1.74 -{
    1.75 -	gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    1.76 -	                             "foo", "bar");
    1.77 -
    1.78 -	fixture->template_string = "{{foo\n}}";
    1.79 -	fixture->expected = "bar";
    1.80 -
    1.81 -	gplate_tag_test_output(fixture, data);
    1.82 -}
    1.83 -
    1.84 -static void
    1.85 -gplate_variable_tag_test_newline_wrapped(GPlateTagTestFixture *fixture,
    1.86 -                                         gconstpointer data)
    1.87 -{
    1.88 -	gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    1.89 -	                             "foo", "bar");
    1.90 -
    1.91 -	fixture->template_string = "{{\nfoo\n}}";
    1.92 -	fixture->expected = "bar";
    1.93 -
    1.94 -	gplate_tag_test_output(fixture, data);
    1.95 -}
    1.96 -
    1.97 -/******************************************************************************
    1.98 - * Main
    1.99 - *****************************************************************************/
   1.100 -gint
   1.101 -main(gint argc, gchar **argv) {
   1.102 -	g_test_init(&argc, &argv, NULL);
   1.103 -
   1.104 -	g_type_init();
   1.105 -
   1.106 -	gplate_config_load_default();
   1.107 -
   1.108 -	gplate_tag_test_add("/tags/variable/single",
   1.109 -	                    gplate_variable_tag_test_single);
   1.110 -
   1.111 -	gplate_tag_test_add("/tags/variable/double",
   1.112 -	                    gplate_variable_tag_test_double);
   1.113 -
   1.114 -	gplate_tag_test_add("/tags/variable/tripple",
   1.115 -	                    gplate_variable_tag_test_tripple);
   1.116 -
   1.117 -	gplate_tag_test_add("/tags/variable/newline_prefix",
   1.118 -	                    gplate_variable_tag_test_newline_prefix);
   1.119 -
   1.120 -	gplate_tag_test_add("/tags/variable/newline_suffix",
   1.121 -	                    gplate_variable_tag_test_newline_suffix);
   1.122 -
   1.123 -	gplate_tag_test_add("/tags/variable/newline_wrapped",
   1.124 -	                    gplate_variable_tag_test_newline_wrapped);
   1.125 -
   1.126 -	return g_test_run();
   1.127 -}
   1.128 -