aboutsummaryrefslogtreecommitdiffstats
path: root/tests/vty
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-06-12 18:34:34 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-06-14 12:43:19 +0200
commit14aadd5b6f12dddd055a7c82c19df4b5ec119843 (patch)
tree66789a6858b3eaac0b3181e338ca1096609afcb4 /tests/vty
parent8930ace072691acb9caf83fa6347f973dacf4263 (diff)
vty: tests: Verify incomplete optional parameters are passed to vty funcs
The test shows that in the case were "single0 on" is executed, VTY function should return complete "single0 one" but it doesn't. Related: OS#4045 Change-Id: Ib5b9dc07e2b280dc95011b3926afb1d490cadd81
Diffstat (limited to 'tests/vty')
-rw-r--r--tests/vty/vty_transcript_test.c9
-rw-r--r--tests/vty/vty_transcript_test.vty9
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/vty/vty_transcript_test.c b/tests/vty/vty_transcript_test.c
index 7ffe713a..6651097e 100644
--- a/tests/vty/vty_transcript_test.c
+++ b/tests/vty/vty_transcript_test.c
@@ -154,6 +154,14 @@ const struct log_info log_info = {
.num_cat = ARRAY_SIZE(default_categories),
};
+DEFUN(single0, single0_cmd,
+ "single0 [one]",
+ "single0 test command\n" "1\n")
+{
+ vty_out(vty, "ok argc=%d%s%s%s", argc, argc ? " " : "", argc ? argv[0] : "", VTY_NEWLINE);
+ return CMD_SUCCESS;
+}
+
DEFUN(multi0, multi0_cmd,
"multi0 (one|two|three)",
"multi0 test command\n" "1\n2\n3\n")
@@ -180,6 +188,7 @@ DEFUN(multi2, multi2_cmd,
static void init_vty_cmds()
{
+ install_element_ve(&single0_cmd);
install_element_ve(&multi0_cmd);
install_element_ve(&multi1_cmd);
install_element_ve(&multi2_cmd);
diff --git a/tests/vty/vty_transcript_test.vty b/tests/vty/vty_transcript_test.vty
index 5ed3c1d7..15577446 100644
--- a/tests/vty/vty_transcript_test.vty
+++ b/tests/vty/vty_transcript_test.vty
@@ -75,3 +75,12 @@ ok argc=1 on
vty_transcript_test> multi2 t
% Ambiguous command.
+
+vty_transcript_test> single0 one
+ok argc=1 one
+
+vty_transcript_test> single0 on
+ok argc=1 on
+
+vty_transcript_test> single0
+ok argc=0