fixeria has uploaded this change for review.
tests/vty: demonstrate a problem with optional-multi-choice
Change-Id: I6ad93a304ce498ba9d57fc7e2fd238e6c16e29e0
Related: b55f4d2df21b966c3953264d8961f259814f4650
---
M tests/vty/vty_transcript_test.c
M tests/vty/vty_transcript_test.vty
2 files changed, 44 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/61/35961/1
diff --git a/tests/vty/vty_transcript_test.c b/tests/vty/vty_transcript_test.c
index 5602c50..f4d3879 100644
--- a/tests/vty/vty_transcript_test.c
+++ b/tests/vty/vty_transcript_test.c
@@ -207,6 +207,14 @@
return CMD_SUCCESS;
}
+DEFUN(multi3, multi3_cmd,
+ "multi3 (foo|bar) [(one|two|three)]",
+ "multi3 test command\n" "foo\nbar\n" "1\n2\n3\n")
+{
+ vty_out(vty, "ok argc=%d%s%s%s", argc, argc ? " " : "", argc ? argv[0] : "", VTY_NEWLINE);
+ return CMD_SUCCESS;
+}
+
#define X(f) (1 << f)
enum {
@@ -380,6 +388,7 @@
install_element_ve(&multi0_cmd);
install_element_ve(&multi1_cmd);
install_element_ve(&multi2_cmd);
+ install_element_ve(&multi3_cmd);
install_element(CONFIG_NODE, &cfg_attr_test_cmd);
install_node(&attr_test_node, NULL);
diff --git a/tests/vty/vty_transcript_test.vty b/tests/vty/vty_transcript_test.vty
index 7df2a60..33edb12 100644
--- a/tests/vty/vty_transcript_test.vty
+++ b/tests/vty/vty_transcript_test.vty
@@ -3,6 +3,7 @@
multi0 (one|two|three)
multi1 ([one]|[two]|[three])
multi2 [(one|two|three)]
+ multi3 (foo|bar) [(one|two|three)]
vty_transcript_test> multi0 ?
one 1
@@ -67,6 +68,27 @@
vty_transcript_test> multi2
ok argc=0
+vty_transcript_test> multi3 ?
+ foo foo
+ bar bar
+
+vty_transcript_test> multi3 foo ?
+ [one] 1
+ [two] 2
+ [three] 3
+
+vty_transcript_test> multi3 foo
+ok argc=1 foo
+
+vty_transcript_test> multi3 bar
+ok argc=1 bar
+
+vty_transcript_test> multi3 foo one
+ok argc=2 foo one
+
+vty_transcript_test> multi3 bar three
+ok argc=2 foo three
+
vty_transcript_test> multi0 thr
ok argc=1 three
@@ -76,6 +98,9 @@
vty_transcript_test> multi2 t
% Ambiguous command.
+vty_transcript_test> multi3 foo t
+% Ambiguous command.
+
vty_transcript_test> single0 one
ok argc=1 one
To view, visit change 35961. To unsubscribe, or for help writing mail filters, visit settings.