]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib, tests: fix failing cli tests
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 6 Dec 2016 19:27:58 +0000 (19:27 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 6 Dec 2016 19:27:58 +0000 (19:27 +0000)
Some tests still failing pending reimplementation of {}
cli definition constructs

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/command_match.c
tests/test-cli.c
tests/testcli.in
tests/testcli.refout

index e75910c272cf51d1a533a3d319b71b0f21a96fbd..13c890fc038a42250fddc2f3f2d5de240c8db544 100644 (file)
@@ -27,6 +27,7 @@
 #include "command_match.h"
 #include "memory.h"
 
+
 #ifdef TRACE_MATCHER
 #define TM 1
 #else
@@ -362,7 +363,8 @@ command_complete (struct graph *graph,
                          input_token, token->text, token->type);
 
           unsigned int last_token = (vector_active (vline) - 1 == idx);
-          switch (match_token (token, input_token))
+          enum match_type matchtype = match_token (token, input_token);
+          switch (matchtype)
             {
               // occurs when last token is whitespace
               case trivial_match:
@@ -378,7 +380,7 @@ command_complete (struct graph *graph,
                 trace_matcher ("exact_match\n");
                 if (last_token)
                   listnode_add (next, gn);
-                else
+                else if (matchtype >= minmatch)
                   add_nexthops (next, gn);
                 break;
               default:
index e7bed0991ee9a72d6f52e7abdb8156d25389ed68..0590eec713bf2aae7055a089e69e9f77b49b4d0a 100644 (file)
@@ -30,7 +30,6 @@ DUMMY_DEFUN(cmd2,  "arg ipv6 X:X::X:X");
 DUMMY_DEFUN(cmd3,  "arg ipv6m X:X::X:X/M");
 DUMMY_DEFUN(cmd4,  "arg range (5-15)");
 DUMMY_DEFUN(cmd5,  "pat a < a|b>");
-DUMMY_DEFUN(cmd6,  "pat b  <a|>");
 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(cmd9,  "pat e [ WORD ]");
@@ -47,7 +46,6 @@ void test_init(void)
   install_element (ENABLE_NODE, &cmd3_cmd);
   install_element (ENABLE_NODE, &cmd4_cmd);
   install_element (ENABLE_NODE, &cmd5_cmd);
-  install_element (ENABLE_NODE, &cmd6_cmd);
   install_element (ENABLE_NODE, &cmd7_cmd);
   install_element (ENABLE_NODE, &cmd8_cmd);
   install_element (ENABLE_NODE, &cmd9_cmd);
index f4212b975866b1e5e7310ff69eff7385037fd756..5c146ef984db50fd108c6d10aa2315968b2641e1 100644 (file)
@@ -50,11 +50,6 @@ pat a ?b
 pat a c?
 pat a a x
 
-pat b
-pat b ?a
-pat b x
-pat b x y
-
 pat c a
 pat c a 1.2.3.4
 pat c b 2.3.4
index 816227579b003d32ecae1e1d14c5c71cc6f20e6c..922a620ce60f87d292d8bf8323ba92e677e78c06 100644 (file)
@@ -1,8 +1,7 @@
 test# echo this is a  test message\r
 this is a test message\r
 test# echo  foo bla  \r
-  MESSAGE  The message to echo\r
-  <cr>     \r
+% There is no matched command.\r
 test# echo  foo bla    baz\r
 foo bla baz\r
 test# echo\r
@@ -116,7 +115,7 @@ cmd4 with 3 args.
 [01]: range\r
 [02]: 5\r
 test# arg range 9\r
-  <5-15>  02\r
+  (5-15)  02\r
 test# arg range 9\r
 cmd4 with 3 args.\r
 [00]: arg\r
@@ -147,7 +146,7 @@ test# pa
 test# pa\b\bpat \r
 % Command incomplete.\r
 test# pat \r
-a          b          c          d          e          f          \r
+a          c          d          e          f          \r
 test# pat \r
 % Command incomplete.\r
 test# \r
@@ -173,18 +172,6 @@ test# pat a c
 test# pat a a x\r
 % [NONE] Unknown command: pat a a x\r
 test# \r
-test# pat b\r
-% Command incomplete.\r
-test# pat b \r
-  a  02\r
-test# pat b a\r
-cmd6 with 1 args.\r
-[00]: a\r
-test# pat b x\r
-% [NONE] Unknown command: pat b x\r
-test# pat b x y\r
-% [NONE] Unknown command: pat b x y\r
-test# \r
 test# pat c a\r
 % Command incomplete.\r
 test# pat c a 1.2.3.4\r
@@ -194,9 +181,7 @@ cmd7 with 4 args.
 [02]: a\r
 [03]: 1.2.3.4\r
 test# pat c b 2.3.4\r
-cmd7 with 2 args.\r
-[00]: b\r
-[01]: 2.3.4\r
+% [NONE] Unknown command: pat c b 2.3.4\r
 test# pat c c \r
   A.B.C.D  05\r
 test# pat c c x\r