gplate/gplate

Parents cfa714f6a78b
Children 5e8eaae7fb30
Added test cases for variables in single quotes and double quotes
--- a/tests/test_syntax.c Mon Dec 24 12:27:12 2007 -0600
+++ b/tests/test_syntax.c Mon Dec 24 12:34:22 2007 -0600
@@ -59,6 +59,28 @@
OUTPUT_TEST(tplate, "one {{ two }} three", "one 2 three");
END_TEST
+START_TEST(test_syntax_var_in_single_quotes)
+ GPlateTemplate *tplate = gplate_template_new();
+ GPlateVariable *var = NULL;
+
+ var = gplate_string_variable_new("quoted", "in quotes");
+ gplate_collection_add_variable(GPLATE_COLLECTION(tplate), var);
+ g_object_unref(G_OBJECT(var));
+
+ OUTPUT_TEST(tplate, "abc '{{ quoted }}' xyz", "abc 'in quotes' xyz");
+END_TEST
+
+START_TEST(test_syntax_var_in_double_quotes)
+ GPlateTemplate *tplate = gplate_template_new();
+ GPlateVariable *var = NULL;
+
+ var = gplate_string_variable_new("quoted", "in quotes");
+ gplate_collection_add_variable(GPLATE_COLLECTION(tplate), var);
+ g_object_unref(G_OBJECT(var));
+
+ OUTPUT_TEST(tplate, "abc \"{{ quoted }}\" xyz", "abc \"in quotes\" xyz");
+END_TEST
+
START_TEST(test_syntax_two_vars_one_block)
GPlateTemplate *tplate = gplate_template_new();
GPlateVariable *var = NULL;
@@ -100,6 +122,8 @@
tcase_add_test(tc, test_syntax_keywords_no_subst);
tcase_add_test(tc, test_syntax_keywords_no_subst_case);
tcase_add_test(tc, test_syntax_one_var);
+ tcase_add_test(tc, test_syntax_var_in_single_quotes);
+ tcase_add_test(tc, test_syntax_var_in_double_quotes);
tcase_add_test(tc, test_syntax_two_vars_one_block);
tcase_add_test(tc, test_syntax_one_var_nested);
suite_add_tcase(s, tc);