tests: fixup for vtysh-grammar merge

Tests weren't updated for vtysh-grammar yet...
NB: things still fail since some CLI behaviour changed.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2016-11-28 18:32:45 +01:00
parent 64bf316f34
commit 6a23719c75
4 changed files with 10 additions and 10 deletions

View File

@ -34,13 +34,13 @@
struct thread_master *master; struct thread_master *master;
int dump_args(struct vty *vty, const char *descr, int dump_args(struct vty *vty, const char *descr,
int argc, const char **argv) int argc, struct cmd_token *argv[])
{ {
int i; int i;
vty_out (vty, "%s with %d args.%s", descr, argc, VTY_NEWLINE); vty_out (vty, "%s with %d args.%s", descr, argc, VTY_NEWLINE);
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
{ {
vty_out (vty, "[%02d]: %s%s", i, argv[i], VTY_NEWLINE); vty_out (vty, "[%02d]: %s%s", i, argv[i]->arg, VTY_NEWLINE);
} }
return CMD_SUCCESS; return CMD_SUCCESS;

View File

@ -36,7 +36,7 @@ extern void test_init (void);
extern struct thread_master *master; extern struct thread_master *master;
extern int dump_args(struct vty *vty, const char *descr, extern int dump_args(struct vty *vty, const char *descr,
int argc, const char **argv); int argc, struct cmd_token *argv[]);
#define DUMMY_HELPSTR \ #define DUMMY_HELPSTR \
"00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n" \ "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n" \

View File

@ -28,10 +28,10 @@ DUMMY_DEFUN(cmd0, "arg ipv4 A.B.C.D");
DUMMY_DEFUN(cmd1, "arg ipv4m A.B.C.D/M"); DUMMY_DEFUN(cmd1, "arg ipv4m A.B.C.D/M");
DUMMY_DEFUN(cmd2, "arg ipv6 X:X::X:X"); DUMMY_DEFUN(cmd2, "arg ipv6 X:X::X:X");
DUMMY_DEFUN(cmd3, "arg ipv6m X:X::X:X/M"); DUMMY_DEFUN(cmd3, "arg ipv6m X:X::X:X/M");
DUMMY_DEFUN(cmd4, "arg range <5-15>"); DUMMY_DEFUN(cmd4, "arg range (5-15)");
DUMMY_DEFUN(cmd5, "pat a ( a|b)"); DUMMY_DEFUN(cmd5, "pat a < a|b>");
DUMMY_DEFUN(cmd6, "pat b (a|)"); DUMMY_DEFUN(cmd6, "pat b <a|>");
DUMMY_DEFUN(cmd7, "pat c (a | b|c) A.B.C.D"); DUMMY_DEFUN(cmd7, "pat c <a | b|c> A.B.C.D");
DUMMY_DEFUN(cmd8, "pat d { foo A.B.C.D|bar X:X::X:X| baz }"); DUMMY_DEFUN(cmd8, "pat d { foo A.B.C.D|bar X:X::X:X| baz }");
DUMMY_DEFUN(cmd9, "pat e [ WORD ]"); DUMMY_DEFUN(cmd9, "pat e [ WORD ]");
DUMMY_DEFUN(cmd10, "pat f [key]"); DUMMY_DEFUN(cmd10, "pat f [key]");

View File

@ -146,7 +146,7 @@ static struct cmd_node keychain_key_node =
}; };
static int static int
test_callback(struct cmd_element *cmd, struct vty *vty, int argc, const char *argv[]) test_callback(const struct cmd_element *cmd, struct vty *vty, int argc, struct cmd_token *argv[])
{ {
int offset; int offset;
int rv; int rv;
@ -162,7 +162,7 @@ test_callback(struct cmd_element *cmd, struct vty *vty, int argc, const char *ar
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
{ {
rv = snprintf(test_buf + offset, sizeof(test_buf) - offset, "%s'%s'", rv = snprintf(test_buf + offset, sizeof(test_buf) - offset, "%s'%s'",
(i == 0) ? ": " : ", ", argv[i]); (i == 0) ? ": " : ", ", argv[i]->arg);
if (rv < 0) if (rv < 0)
abort(); abort();
offset += rv; offset += rv;
@ -332,7 +332,7 @@ test_run(struct prng *prng, struct vty *vty, const char *cmd, unsigned int edit_
for (j = 0; j < vector_active(descriptions); j++) for (j = 0; j < vector_active(descriptions); j++)
{ {
struct cmd_token *cmd = vector_slot(descriptions, j); struct cmd_token *cmd = vector_slot(descriptions, j);
printf(" '%s' '%s'\n", cmd->cmd, cmd->desc); printf(" '%s' '%s'\n", cmd->text, cmd->desc);
} }
vector_free(descriptions); vector_free(descriptions);
} }