[Libguestfs] [PATCH 3/3] mllib: tests: Add tests of the new Getopt module.

Pino Toscano ptoscano at redhat.com
Mon Jul 18 08:16:48 UTC 2016


On Friday, 15 July 2016 22:37:29 CEST Richard W.M. Jones wrote:
> ---

Good idea, just a couple of notes.

> +(* Test the Getopt module.  The tests are controlled by the
> + * test-getopt.sh script.
> + *)
> +
> +open Printf
> +
> +open Common_utils

Theoretically Getopt is not tied to Common_utils, so it could be tested
without it.

> +
> +t=./getopt_tests
> +
> +expect_fail ()
> +{
> +    if "$@"; then
> +        echo "$@" ": this command was expected to exit with an error"
> +        exit 1
> +    fi
> +}
> +
> +# Program works.
> +$t

Just wondering whether GNU expect could be used here.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160718/ba8008ba/attachment.sig>


More information about the Libguestfs mailing list