From bffe74e67f69fb4ad928230e86ca776bd39ae432 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 1 Apr 2018 18:37:30 +0200 Subject: Implement combined flags (-xyz vs -x -y -z) and values (--foo=bar) support Both are enabled by default but can be disable with --no-combined-flags and --no-combined-values options. --- tests/combined/testscript | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 tests/combined/testscript (limited to 'tests/combined/testscript') diff --git a/tests/combined/testscript b/tests/combined/testscript new file mode 100644 index 0000000..a6f827b --- /dev/null +++ b/tests/combined/testscript @@ -0,0 +1,84 @@ +# file : tests/combined/testscript +# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC +# 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 + : + cat <=options; + --foo=123 + EOI + $* --file=options >'--foo=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