1 #include <gplate/gplate.h>
5 #include "gplate-tag-test.h"
7 /******************************************************************************
9 *****************************************************************************/
11 gplate_variable_tag_test_single(GPlateTagTestFixture *fixture,
14 gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
17 fixture->template_string = "{{ foo }}";
18 fixture->expected = "bar";
20 gplate_tag_test_output(fixture, data);
24 gplate_variable_tag_test_double(GPlateTagTestFixture *fixture,
27 gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
29 gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
32 fixture->template_string = "{{ foo }}{{ bar }}";
33 fixture->expected = "foobar";
35 gplate_tag_test_output(fixture, data);
39 gplate_variable_tag_test_tripple(GPlateTagTestFixture *fixture,
42 gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
44 gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
46 gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
49 fixture->template_string = "{{ foo }}{{ bar }}{{ baz }}";
50 fixture->expected = "foobarbaz";
52 gplate_tag_test_output(fixture, data);
56 gplate_variable_tag_test_newline_prefix(GPlateTagTestFixture *fixture,
59 gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
62 fixture->template_string = "{{\nfoo}}";
63 fixture->expected = "bar";
65 gplate_tag_test_output(fixture, data);
69 gplate_variable_tag_test_newline_suffix(GPlateTagTestFixture *fixture,
72 gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
75 fixture->template_string = "{{foo\n}}";
76 fixture->expected = "bar";
78 gplate_tag_test_output(fixture, data);
82 gplate_variable_tag_test_newline_wrapped(GPlateTagTestFixture *fixture,
85 gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
88 fixture->template_string = "{{\nfoo\n}}";
89 fixture->expected = "bar";
91 gplate_tag_test_output(fixture, data);
94 /******************************************************************************
96 *****************************************************************************/
98 main(gint argc, gchar **argv) {
99 g_test_init(&argc, &argv, NULL);
103 gplate_config_load_default();
105 gplate_tag_test_add("/tags/variable/single",
106 gplate_variable_tag_test_single);
108 gplate_tag_test_add("/tags/variable/double",
109 gplate_variable_tag_test_double);
111 gplate_tag_test_add("/tags/variable/tripple",
112 gplate_variable_tag_test_tripple);
114 gplate_tag_test_add("/tags/variable/newline_prefix",
115 gplate_variable_tag_test_newline_prefix);
117 gplate_tag_test_add("/tags/variable/newline_suffix",
118 gplate_variable_tag_test_newline_suffix);
120 gplate_tag_test_add("/tags/variable/newline_wrapped",
121 gplate_variable_tag_test_newline_wrapped);