res_pjsip_config_wizard/config: Fix template processing
[asterisk/asterisk.git] / tests / test_config.c
index ad7ddca..12c75bf 100644 (file)
@@ -234,6 +234,7 @@ AST_TEST_DEFINE(config_basic_ops)
        struct ast_config *cfg = NULL;
        struct ast_category *cat = NULL;
        struct ast_variable *var;
+       struct ast_variable *varlist;
        char temp[32];
        const char *cat_name;
        const char *var_value;
@@ -537,6 +538,22 @@ AST_TEST_DEFINE(config_basic_ops)
                goto out;
        }
 
+       varlist = ast_variable_new("name1", "value1", "");
+       ast_variable_list_append_hint(&varlist, NULL, ast_variable_new("name1", "value2", ""));
+       ast_variable_list_append_hint(&varlist, NULL, ast_variable_new("name1", "value3", ""));
+
+       var_value = ast_variable_find_in_list(varlist, "name1");
+       if (strcmp(var_value, "value1") != 0) {
+               ast_test_status_update(test, "Wrong variable retrieved %s.\n", var_value);
+               goto out;
+       }
+
+       var_value = ast_variable_find_last_in_list(varlist, "name1");
+       if (strcmp(var_value, "value3") != 0) {
+               ast_test_status_update(test, "Wrong variable retrieved %s.\n", var_value);
+               goto out;
+       }
+
        res = AST_TEST_PASS;
 
 out: