summaryrefslogtreecommitdiff
path: root/cli-tests/combined/testscript
diff options
context:
space:
mode:
Diffstat (limited to 'cli-tests/combined/testscript')
-rw-r--r--cli-tests/combined/testscript108
1 files changed, 108 insertions, 0 deletions
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 <<EOI >=options;
+ --foo=123
+ EOI
+ $* --file=options >'--foo=123'
+
+ : equal-in-value
+ :
+ cat <<EOI >=options;
+ --foo bar=123
+ EOI
+ $* --file=options >'--foo=bar=123'
+
+ : space-in-value
+ :
+ cat <<EOI >=options;
+ --foo= 123
+ EOI
+ $* --file=options >'--foo= 123'
+
+ : quoted-value
+ :
+ cat <<EOI >=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
+}