From 720c5a33b6a49cf328fdd7611f49153cf8f60247 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 8 Apr 2020 14:51:57 +0300 Subject: Separate tests and examples into individual packages Also make cli module to be explicitly enabled via the config.cli configuration variable. --- cli-tests/combined/testscript | 108 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 cli-tests/combined/testscript (limited to 'cli-tests/combined/testscript') diff --git a/cli-tests/combined/testscript b/cli-tests/combined/testscript new file mode 100644 index 0000000..d1f9830 --- /dev/null +++ b/cli-tests/combined/testscript @@ -0,0 +1,108 @@ +# file : combined/testscript +# license : MIT; see accompanying LICENSE file + +: values +: +{ + : long + : + $* --foo=123 >'--foo=123' + + : short + : + $* -f=123 >'--foo=123' + + : empty + : + $* --foo= >'--foo=' + + : unknown-option-long + : + $* --bar=123 2>>EOE != 0 + unknown option '--bar' + EOE + + : unknown-option-short + : + $* -b=123 2>>EOE != 0 + unknown option '-b' + EOE + + : unknown-value + : + $* --xyz=123 2>>EOE != 0 + invalid value '123' for option '--xyz' + EOE + + : options-file + : + { + : basics + : + cat <=options; + --foo=123 + EOI + $* --file=options >'--foo=123' + + : equal-in-value + : + cat <=options; + --foo bar=123 + EOI + $* --file=options >'--foo=bar=123' + + : space-in-value + : + cat <=options; + --foo= 123 + EOI + $* --file=options >'--foo= 123' + + : quoted-value + : + cat <=options; + --foo="'bar 123'" + EOI + $* --file=options >"--foo='bar 123'" + } +} + +: flags +: +{ + : basic + : + $* -zyx >'-xyz' + + : separate + : + $* -zx -y >'-xyz' + + : long + : + $* --xyz >'--xyz' + + : unknown-option + : + $* -xYz 2>>EOE != 0 + unknown option '-Y' + EOE + + : alnum-only + : + $* -xy+ 2>>EOE != 0 + unknown option '-xy+' + EOE + + : flags-only + : + $* -xyf 123 2>>EOE != 0 + missing value for option '-f' + EOE + + : flags-only-combined + : + $* -xyf=123 2>>EOE != 0 + missing value for option '-f' + EOE +} -- cgit v1.1