]> xenbits.xensource.com Git - libvirt.git/commitdiff
virshtest: Add tests for '--help'
authorPeter Krempa <pkrempa@redhat.com>
Wed, 15 May 2024 06:53:08 +0000 (08:53 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 16 May 2024 07:03:48 +0000 (09:03 +0200)
Add test cases for help handling.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
tests/virshtest.c
tests/virshtestdata/help-option.in [new file with mode: 0644]
tests/virshtestdata/help-option.out [new file with mode: 0644]

index 03d499b75969404e3e34c5cdadfacef665076740..b86c39285aa5ba9f86c102e58a8561554cb84778 100644 (file)
@@ -309,6 +309,9 @@ mymain(void)
     DO_TEST("#unbalanced; 'quotes\"\necho a # b");
     DO_TEST("\\# ignored;echo a\n'#also' ignored");
 
+    /* test of the --help option handling */
+    DO_TEST_SCRIPT("help-option", NULL, VIRSH_DEFAULT, "-q");
+
     /* test of splitting in vshStringToArray */
     DO_TEST_SCRIPT("echo-split", NULL, VIRSH_DEFAULT, "-q");
 
diff --git a/tests/virshtestdata/help-option.in b/tests/virshtestdata/help-option.in
new file mode 100644 (file)
index 0000000..655952e
--- /dev/null
@@ -0,0 +1,4 @@
+help echo
+echo --help
+echo --help=data
+echo --help data
diff --git a/tests/virshtestdata/help-option.out b/tests/virshtestdata/help-option.out
new file mode 100644 (file)
index 0000000..5b7510b
--- /dev/null
@@ -0,0 +1,64 @@
+  NAME
+    echo - echo arguments. Used for internal testing.
+
+  SYNOPSIS
+    echo [--shell] [--xml] [--split] [--err] [--prefix <string>] [<string>]...
+
+  DESCRIPTION
+    Echo back arguments, possibly with quoting. Used for internal testing.
+
+  OPTIONS
+    --shell          escape for shell use
+    --xml            escape for XML use
+    --split          split each argument on ','; ',,' is an escape sequence
+    --err            output to stderr
+    --prefix <string>  prefix the message
+    [--string] <string>...  arguments to echo
+  NAME
+    echo - echo arguments. Used for internal testing.
+
+  SYNOPSIS
+    echo [--shell] [--xml] [--split] [--err] [--prefix <string>] [<string>]...
+
+  DESCRIPTION
+    Echo back arguments, possibly with quoting. Used for internal testing.
+
+  OPTIONS
+    --shell          escape for shell use
+    --xml            escape for XML use
+    --split          split each argument on ','; ',,' is an escape sequence
+    --err            output to stderr
+    --prefix <string>  prefix the message
+    [--string] <string>...  arguments to echo
+  NAME
+    echo - echo arguments. Used for internal testing.
+
+  SYNOPSIS
+    echo [--shell] [--xml] [--split] [--err] [--prefix <string>] [<string>]...
+
+  DESCRIPTION
+    Echo back arguments, possibly with quoting. Used for internal testing.
+
+  OPTIONS
+    --shell          escape for shell use
+    --xml            escape for XML use
+    --split          split each argument on ','; ',,' is an escape sequence
+    --err            output to stderr
+    --prefix <string>  prefix the message
+    [--string] <string>...  arguments to echo
+  NAME
+    echo - echo arguments. Used for internal testing.
+
+  SYNOPSIS
+    echo [--shell] [--xml] [--split] [--err] [--prefix <string>] [<string>]...
+
+  DESCRIPTION
+    Echo back arguments, possibly with quoting. Used for internal testing.
+
+  OPTIONS
+    --shell          escape for shell use
+    --xml            escape for XML use
+    --split          split each argument on ','; ',,' is an escape sequence
+    --err            output to stderr
+    --prefix <string>  prefix the message
+    [--string] <string>...  arguments to echo