On Fri, Apr 19, 2024 at 15:05:23 +0200, Peter Krempa wrote:
Add both single invocations as well as a script containing the same
commands.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
[...]
diff --git a/tests/virshtest.c b/tests/virshtest.c
index 14a96f2d35..869ecbb358 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -342,6 +342,43 @@ mymain(void)
"checkpoint-create test --redefine checkpoint-c2.xml ;"
"checkpoint-info test c2");
+ DO_TEST_FULL("completion-command", NULL, VIRSH_CUSTOM,
+ "complete", "--", "ech");
+ DO_TEST_FULL("completion-command-complete", NULL, VIRSH_CUSTOM,
+ "complete", "--", "echo");
+ DO_TEST_FULL("completion-args", NULL, VIRSH_CUSTOM,
+ "complete", "--", "echo", "");
+ DO_TEST_FULL("completion-arg-partial", NULL, VIRSH_CUSTOM,
+ "complete", "--", "echo",
"--xm", "--s");
+ DO_TEST_FULL("completion-arg-full-bool", NULL, VIRSH_CUSTOM,
+ "complete", "--", "echo",
"--nonexistant-arg", "--xml");
+ DO_TEST_FULL("completion-arg-full-bool-next", NULL, VIRSH_CUSTOM,
+ "complete", "--", "echo",
"--nonexistant-arg", "--xml", "");
+ DO_TEST_FULL("completion-arg-full-string", NULL, VIRSH_CUSTOM,
+ "complete", "--", "echo",
"--nonexistant-arg", "--prefix");
+ DO_TEST_FULL("completion-arg-full-string-next", NULL, VIRSH_CUSTOM,
+ "complete", "--", "echo",
"--nonexistant-arg", "--prefix", "");
+ DO_TEST_FULL("completion-arg-full-argv", NULL, VIRSH_CUSTOM,
+ "complete", "--", "domstats",
"--domain");
+ DO_TEST_FULL("completion-arg-full-argv-next", NULL, VIRSH_DEFAULT,
+ "complete", "--", "domstats",
"--domain", "");
+ DO_TEST_FULL("completion-argv-multiple", NULL, VIRSH_CUSTOM,
+ "complete", "--", "domstats",
"--domain", "fc", "--domain", "fv");
+ DO_TEST_FULL("completion-argv-multiple-next", NULL, VIRSH_CUSTOM,
+ "complete", "--", "domstats",
"--domain", "fv", "--domain", "fc",
"");
+ DO_TEST_FULL("completion-argv-multiple-positional", NULL, VIRSH_CUSTOM,
+ "complete", "--", "domstats",
"--domain", "fc", "fv");
+ DO_TEST_FULL("completion-argv-multiple-positional-next", NULL,
VIRSH_CUSTOM,
+ "complete", "--", "domstats",
"--domain", "fc", "fv", "");
+ DO_TEST_FULL("completion-arg-positional-empty", NULL, VIRSH_CUSTOM,
+ "complete", "--", "domstate",
"");
+ DO_TEST_FULL("completion-arg-positional-partial", NULL, VIRSH_CUSTOM,
+ "complete", "--", "domstate",
"fv");
+ DO_TEST_FULL("completion-arg-positional-partial-next", NULL,
VIRSH_CUSTOM,
+ "complete", "--", "domstate",
"fv", "");
+
+ DO_TEST_SCRIPT("completion", NULL, VIRSH_DEFAULT);
Running this trhough CI revealed that I forgot to skip these when
readline is not compiled in, which I'll squash into this patch.
Additionally two memleaks were found in the original code revealed by
this patch, which I've sent patches for.