virshtest: Add tests for '--help'

Add test cases for help handling.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Peter Krempa 2024-05-15 08:53:08 +02:00
parent 811ce0e13b
commit 6d098a0ced
3 changed files with 71 additions and 0 deletions

View File

@ -309,6 +309,9 @@ mymain(void)
DO_TEST("#unbalanced; 'quotes\"\necho a # b"); DO_TEST("#unbalanced; 'quotes\"\necho a # b");
DO_TEST("\\# ignored;echo a\n'#also' ignored"); 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 */ /* test of splitting in vshStringToArray */
DO_TEST_SCRIPT("echo-split", NULL, VIRSH_DEFAULT, "-q"); DO_TEST_SCRIPT("echo-split", NULL, VIRSH_DEFAULT, "-q");

View File

@ -0,0 +1,4 @@
help echo
echo --help
echo --help=data
echo --help data

View File

@ -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