1 #include <gplate/gplate.h>
5 #include "gplate-tag-test.h"
7 /******************************************************************************
9 *****************************************************************************/
11 gplate_variable_tag_test(GPlateTagTestFixture *fixture, gconstpointer data,
12 const gchar *template_string, const gchar *expected,
16 const gchar *name = NULL, *value = NULL;
18 fixture->template_string = template_string;
19 fixture->expected = expected;
21 va_start(vargs, expected);
22 while((name = va_arg(vargs, const gchar *))) {
23 value = va_arg(vargs, const gchar *);
25 gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
31 gplate_tag_test_output(fixture, data);
34 /******************************************************************************
36 *****************************************************************************/
38 gplate_variable_tag_test_single(GPlateTagTestFixture *fixture,
41 gplate_variable_tag_test(fixture, data,
48 gplate_variable_tag_test_double(GPlateTagTestFixture *fixture,
51 gplate_variable_tag_test(fixture, data,
52 "{{ foo }}{{ bar }}", "foobar",
59 gplate_variable_tag_test_tripple(GPlateTagTestFixture *fixture,
62 gplate_variable_tag_test(fixture, data,
63 "{{ foo }}{{ bar }}{{ baz }}", "foobarbaz",
71 gplate_variable_tag_test_newline_prefix(GPlateTagTestFixture *fixture,
74 gplate_variable_tag_test(fixture, data,
81 gplate_variable_tag_test_newline_suffix(GPlateTagTestFixture *fixture,
84 gplate_variable_tag_test(fixture, data,
91 gplate_variable_tag_test_newline_wrapped(GPlateTagTestFixture *fixture,
94 gplate_variable_tag_test(fixture, data,
101 gplate_variable_tag_test_single_quotes(GPlateTagTestFixture *fixture,
104 gplate_variable_tag_test(fixture, data,
105 "foo '{{ bar }}' baz", "foo 'bar' baz",
111 gplate_variable_tag_test_double_quotes(GPlateTagTestFixture *fixture,
114 gplate_variable_tag_test(fixture, data,
115 "foo \"{{ bar }}\" baz", "foo \"bar\" baz",
121 gplate_variable_tag_test_mixed_quotes(GPlateTagTestFixture *fixture,
124 gplate_variable_tag_test(fixture, data,
125 "foo \"{{ bar }}' baz", "foo \"bar' baz",
129 gplate_variable_tag_test(fixture, data,
130 "foo '{{ bar }}\" baz", "foo 'bar\" baz",
134 /******************************************************************************
136 *****************************************************************************/
138 main(gint argc, gchar **argv) {
139 g_test_init(&argc, &argv, NULL);
143 gplate_config_load_default();
145 gplate_tag_test_add("/tags/variable/single",
146 gplate_variable_tag_test_single);
148 gplate_tag_test_add("/tags/variable/double",
149 gplate_variable_tag_test_double);
151 gplate_tag_test_add("/tags/variable/tripple",
152 gplate_variable_tag_test_tripple);
154 gplate_tag_test_add("/tags/variable/newline_prefix",
155 gplate_variable_tag_test_newline_prefix);
157 gplate_tag_test_add("/tags/variable/newline_suffix",
158 gplate_variable_tag_test_newline_suffix);
160 gplate_tag_test_add("/tags/variable/newline_wrapped",
161 gplate_variable_tag_test_newline_wrapped);
163 gplate_tag_test_add("/tags/variable/quotes/single",
164 gplate_variable_tag_test_single_quotes);
166 gplate_tag_test_add("/tags/variable/quotes/double",
167 gplate_variable_tag_test_double_quotes);
169 gplate_tag_test_add("/tags/variable/quotes/mixed",
170 gplate_variable_tag_test_mixed_quotes);