pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/41705?usp=email ) Change subject: vty/test: Validate optional-multi-choice param followed by optional-multi-choice param ...................................................................... vty/test: Validate optional-multi-choice param followed by optional-multi-choice param Change-Id: I4517437c19190200181fecb9bbaf075b507ad7f3 --- M tests/vty/vty_transcript_test.c M tests/vty/vty_transcript_test.vty 2 files changed, 37 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/tests/vty/vty_transcript_test.c b/tests/vty/vty_transcript_test.c index 5f8157a..ac5bb75 100644 --- a/tests/vty/vty_transcript_test.c +++ b/tests/vty/vty_transcript_test.c @@ -218,6 +218,17 @@ return CMD_SUCCESS; } +DEFUN(multi4, multi4_cmd, + "multi4 [(foo|bar)] [(one|two|three)]", + "multi4 test command\n" "foo\nbar\n" "1\n2\n3\n") +{ + vty_out(vty, "ok argc=%d%s%s%s%s%s", argc, + argc > 0 ? " " : "", argc > 0 ? argv[0] : "", + argc > 1 ? " " : "", argc > 1 ? argv[1] : "", + VTY_NEWLINE); + return CMD_SUCCESS; +} + #define X(f) (1 << f) enum { @@ -392,6 +403,7 @@ install_element_ve(&multi1_cmd); install_element_ve(&multi2_cmd); install_element_ve(&multi3_cmd); + install_element_ve(&multi4_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 a1c044a..938c949 100644 --- a/tests/vty/vty_transcript_test.vty +++ b/tests/vty/vty_transcript_test.vty @@ -4,6 +4,7 @@ multi1 ([one]|[two]|[three]) multi2 [(one|two|three)] multi3 (foo|bar) [(one|two|three)] + multi4 [(foo|bar)] [(one|two|three)] vty_transcript_test> multi0 ? one 1 @@ -89,6 +90,27 @@ vty_transcript_test> multi3 bar three ok argc=2 bar three +vty_transcript_test> multi4 ? + [foo] foo + [bar] bar + +vty_transcript_test> multi4 foo ? + [one] 1 + [two] 2 + [three] 3 + +vty_transcript_test> multi4 foo +ok argc=1 foo + +vty_transcript_test> multi4 bar +ok argc=1 bar + +vty_transcript_test> multi4 foo one +ok argc=2 foo one + +vty_transcript_test> multi3 bar three +ok argc=2 bar three + vty_transcript_test> multi0 thr ok argc=1 three @@ -101,6 +123,9 @@ vty_transcript_test> multi3 foo t % Ambiguous command. +vty_transcript_test> multi4 foo t +% Ambiguous command. + vty_transcript_test> single0 one ok argc=1 one -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41705?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I4517437c19190200181fecb9bbaf075b507ad7f3 Gerrit-Change-Number: 41705 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: falconia <falcon@freecalypso.org> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de>