summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2017-11-27 12:11:18 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-11-27 12:11:18 -0600
commit93dba6f39670d3b39e05831fa685698227b8c7f3 (patch)
tree5aae634ca53c0ab09e5ae4e5fbc9319d096abdd6 /tests
parent2e4a8f00362b2c0df3a9d811a97e7649f5fa1b10 (diff)
parenta02cbc2ef3903c68737fddee79d8db1d66623ab4 (diff)
Merge "CLI: Remove calls to ast_cli_generator."
Diffstat (limited to 'tests')
-rw-r--r--tests/test_substitution.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/test_substitution.c b/tests/test_substitution.c
index 3a1dc1fba..8b9a164aa 100644
--- a/tests/test_substitution.c
+++ b/tests/test_substitution.c
@@ -43,6 +43,7 @@
#include "asterisk/stringfields.h"
#include "asterisk/threadstorage.h"
#include "asterisk/test.h"
+#include "asterisk/vector.h"
static enum ast_test_result_state test_chan_integer(struct ast_test *test,
struct ast_channel *c, int *ifield, const char *expression)
@@ -225,6 +226,7 @@ AST_TEST_DEFINE(test_substitution)
struct ast_channel *c;
int i;
enum ast_test_result_state res = AST_TEST_PASS;
+ struct ast_vector_string *funcs;
switch (cmd) {
case TEST_INIT:
@@ -302,11 +304,12 @@ AST_TEST_DEFINE(test_substitution)
#undef TEST
/* For testing dialplan functions */
- for (i = 0; ; i++) {
- char *cmd = ast_cli_generator("core show function", "", i);
- if (cmd == NULL) {
- break;
- }
+ funcs = ast_cli_completion_vector("core show function", "");
+
+ /* Skip "best match" element 0 */
+ for (i = 1; funcs && i < AST_VECTOR_SIZE(funcs); i++) {
+ char *cmd = AST_VECTOR_GET(funcs, i);
+
if (strcmp(cmd, "CHANNEL") && strcmp(cmd, "CALLERID") && strncmp(cmd, "CURL", 4) &&
strncmp(cmd, "AES", 3) && strncmp(cmd, "BASE64", 6) &&
strcmp(cmd, "CDR") && strcmp(cmd, "ENV") && strcmp(cmd, "GLOBAL") &&
@@ -321,10 +324,14 @@ AST_TEST_DEFINE(test_substitution)
}
}
}
- ast_free(cmd);
}
+ if (funcs) {
+ AST_VECTOR_CALLBACK_VOID(funcs, ast_free);
+ AST_VECTOR_PTR_FREE(funcs);
+ }
ast_hangup(c);
+
return res;
}