1.1 --- a/gplate/tags/tests/test-gplate-variable-tag.c Sun Jul 04 03:40:27 2010 -0500
1.2 +++ b/gplate/tags/tests/test-gplate-variable-tag.c Sun Jul 04 15:34:45 2010 -0500
1.3 @@ -143,6 +143,47 @@
1.4 "bar", "bar",
1.5 NULL);
1.6 }
1.7 +
1.8 +static void
1.9 +test_gplate_variable_tag_two_vars_one_block(TestGPlateTagFixture *fixture,
1.10 + gconstpointer data)
1.11 +{
1.12 + test_gplate_variable_tag(fixture, data,
1.13 + "one {{ two five }} three",
1.14 + "one 2 three",
1.15 + "two", "2",
1.16 + "five", "5",
1.17 + NULL);
1.18 +}
1.19 +
1.20 +static void
1.21 +test_gplate_variable_tag_nested_single(TestGPlateTagFixture *fixture,
1.22 + gconstpointer data)
1.23 +{
1.24 + GPlateVariable *dict = gplate_dictionary_variable_new("foo");
1.25 +
1.26 + gplate_collection_add_string(GPLATE_COLLECTION(dict),
1.27 + "bar", "baz");
1.28 +
1.29 + test_gplate_tag_output(fixture, data, "{{ foo.bar }}", "baz");
1.30 +}
1.31 +
1.32 +static void
1.33 +test_gplate_variable_tag_nested_double(TestGPlateTagFixture *fixture,
1.34 + gconstpointer data)
1.35 +{
1.36 + GPlateVariable *dict1 = gplate_dictionary_variable_new("foo");
1.37 + GPlateVariable *dict2 = gplate_dictionary_variable_new("bar");
1.38 +
1.39 + gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
1.40 + dict1);
1.41 + gplate_collection_add_variable(GPLATE_COLLECTION(dict1), dict2);
1.42 + gplate_collection_add_string(GPLATE_COLLECTION(dict2),
1.43 + "baz", "42");
1.44 +
1.45 + test_gplate_tag_output(fixture, data, "{{ foo.bar.baz }}", "42");
1.46 +}
1.47 +
1.48 /******************************************************************************
1.49 * Main
1.50 *****************************************************************************/
1.51 @@ -181,6 +222,15 @@
1.52 test_gplate_tag_add("/tags/variable/quotes/mixed",
1.53 test_gplate_variable_tag_mixed_quotes);
1.54
1.55 + test_gplate_tag_add("/tags/variable/two_vars_one_block",
1.56 + test_gplate_variable_tag_two_vars_one_block);
1.57 +
1.58 + test_gplate_tag_add("/tags/variables/nested/single",
1.59 + test_gplate_variable_tag_nested_single);
1.60 +
1.61 + test_gplate_tag_add("/tags/variable/nested/double",
1.62 + test_gplate_variable_tag_nested_double);
1.63 +
1.64 return g_test_run();
1.65 }
1.66