summaryrefslogtreecommitdiffstats
path: root/tests/expected/getopt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:42:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:42:50 +0000
commit8cb83eee5a58b1fad74c34094ce3afb9e430b5a4 (patch)
treea9b2e7baeca1be40eb734371e3c8b11b02294497 /tests/expected/getopt
parentInitial commit. (diff)
downloadutil-linux-upstream/2.33.1.tar.xz
util-linux-upstream/2.33.1.zip
Adding upstream version 2.33.1.upstream/2.33.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/expected/getopt')
-rw-r--r--tests/expected/getopt/basic9
-rw-r--r--tests/expected/getopt/options-alternative_option_clash2
-rw-r--r--tests/expected/getopt/options-alternative_option_long2
-rw-r--r--tests/expected/getopt/options-alternative_option_short2
-rw-r--r--tests/expected/getopt/options-compatible5
-rw-r--r--tests/expected/getopt/options-csh2
-rw-r--r--tests/expected/getopt/options-invalid_getopt_option3
-rw-r--r--tests/expected/getopt/options-invocation_model_one2
-rw-r--r--tests/expected/getopt/options-invocation_model_three_as_one2
-rw-r--r--tests/expected/getopt/options-invocation_model_two_as_one2
-rw-r--r--tests/expected/getopt/options-invocation_without_parameters3
-rw-r--r--tests/expected/getopt/options-long_option_ambiguous_13
-rw-r--r--tests/expected/getopt/options-longopts2
-rw-r--r--tests/expected/getopt/options-name_option_long4
-rw-r--r--tests/expected/getopt/options-name_option_short4
-rw-r--r--tests/expected/getopt/options-no-arguments3
-rw-r--r--tests/expected/getopt/options-non-option4
-rw-r--r--tests/expected/getopt/options-posix_correctly4
-rw-r--r--tests/expected/getopt/options-quiet_option_long2
-rw-r--r--tests/expected/getopt/options-quiet_option_short2
-rw-r--r--tests/expected/getopt/options-quiet_output_option_long5
-rw-r--r--tests/expected/getopt/options-quiet_output_option_short5
-rw-r--r--tests/expected/getopt/options-same_long_short_options2
-rw-r--r--tests/expected/getopt/options-sh2
-rw-r--r--tests/expected/getopt/options-test_for_enhanced_getopt1
-rw-r--r--tests/expected/getopt/options-unknown_options4
-rw-r--r--tests/expected/getopt/options-unquoted_option_bash5
-rw-r--r--tests/expected/getopt/options-unquoted_option_tcsh5
-rw-r--r--tests/expected/getopt/options-weird_quoting_bash5
-rw-r--r--tests/expected/getopt/options-weird_quoting_tcsh2
30 files changed, 98 insertions, 0 deletions
diff --git a/tests/expected/getopt/basic b/tests/expected/getopt/basic
new file mode 100644
index 0000000..c2c90ae
--- /dev/null
+++ b/tests/expected/getopt/basic
@@ -0,0 +1,9 @@
+Option a
+Option b, argument `1'
+Option c, argument `2'
+Option a
+Option b, argument `3'
+Option c, no argument
+Remaining arguments:
+--> `foo'
+--> `bar'
diff --git a/tests/expected/getopt/options-alternative_option_clash b/tests/expected/getopt/options-alternative_option_clash
new file mode 100644
index 0000000..04ae19d
--- /dev/null
+++ b/tests/expected/getopt/options-alternative_option_clash
@@ -0,0 +1,2 @@
+ -a --abcde --abcde -a -c --
+exit value: 0
diff --git a/tests/expected/getopt/options-alternative_option_long b/tests/expected/getopt/options-alternative_option_long
new file mode 100644
index 0000000..0f5fc19
--- /dev/null
+++ b/tests/expected/getopt/options-alternative_option_long
@@ -0,0 +1,2 @@
+ -a --one --two 'MANDATORY' --three 'OPTIONAL' --
+exit value: 0
diff --git a/tests/expected/getopt/options-alternative_option_short b/tests/expected/getopt/options-alternative_option_short
new file mode 100644
index 0000000..0f5fc19
--- /dev/null
+++ b/tests/expected/getopt/options-alternative_option_short
@@ -0,0 +1,2 @@
+ -a --one --two 'MANDATORY' --three 'OPTIONAL' --
+exit value: 0
diff --git a/tests/expected/getopt/options-compatible b/tests/expected/getopt/options-compatible
new file mode 100644
index 0000000..66e42a7
--- /dev/null
+++ b/tests/expected/getopt/options-compatible
@@ -0,0 +1,5 @@
+getopt: missing optstring argument
+Try 'getopt --help' for more information.
+exit value: 2
+ --
+exit value: 0
diff --git a/tests/expected/getopt/options-csh b/tests/expected/getopt/options-csh
new file mode 100644
index 0000000..86e48f4
--- /dev/null
+++ b/tests/expected/getopt/options-csh
@@ -0,0 +1,2 @@
+ -a -b '1' -c '2' --a-long --b-long '3' --c-long '' -- 'foo' 'bar'
+exit value: 0
diff --git a/tests/expected/getopt/options-invalid_getopt_option b/tests/expected/getopt/options-invalid_getopt_option
new file mode 100644
index 0000000..b3577e0
--- /dev/null
+++ b/tests/expected/getopt/options-invalid_getopt_option
@@ -0,0 +1,3 @@
+getopt: invalid option -- 'b'
+Try 'getopt --help' for more information.
+exit value: 2
diff --git a/tests/expected/getopt/options-invocation_model_one b/tests/expected/getopt/options-invocation_model_one
new file mode 100644
index 0000000..ca4ddca
--- /dev/null
+++ b/tests/expected/getopt/options-invocation_model_one
@@ -0,0 +1,2 @@
+ -b -d -e OPTIONAL1 -f -a -c -ISREQUIRED -g BECOMES THREE ARGUMENTS -- ARG0 ARG1 NOT_OPTIONAL ARG2 ARG3
+exit value: 0
diff --git a/tests/expected/getopt/options-invocation_model_three_as_one b/tests/expected/getopt/options-invocation_model_three_as_one
new file mode 100644
index 0000000..1d4701f
--- /dev/null
+++ b/tests/expected/getopt/options-invocation_model_three_as_one
@@ -0,0 +1,2 @@
+ -b -d '' -e 'OPTIONAL1' -f '' -a -c '-ISREQUIRED' -g 'BECOMES THREE ARGUMENTS' -- 'ARG0' 'ARG1' 'NOT_OPTIONAL' 'ARG2' 'ARG3'
+exit value: 0
diff --git a/tests/expected/getopt/options-invocation_model_two_as_one b/tests/expected/getopt/options-invocation_model_two_as_one
new file mode 100644
index 0000000..1d4701f
--- /dev/null
+++ b/tests/expected/getopt/options-invocation_model_two_as_one
@@ -0,0 +1,2 @@
+ -b -d '' -e 'OPTIONAL1' -f '' -a -c '-ISREQUIRED' -g 'BECOMES THREE ARGUMENTS' -- 'ARG0' 'ARG1' 'NOT_OPTIONAL' 'ARG2' 'ARG3'
+exit value: 0
diff --git a/tests/expected/getopt/options-invocation_without_parameters b/tests/expected/getopt/options-invocation_without_parameters
new file mode 100644
index 0000000..f1ecc16
--- /dev/null
+++ b/tests/expected/getopt/options-invocation_without_parameters
@@ -0,0 +1,3 @@
+getopt: missing optstring argument
+Try 'getopt --help' for more information.
+exit value: 2
diff --git a/tests/expected/getopt/options-long_option_ambiguous_1 b/tests/expected/getopt/options-long_option_ambiguous_1
new file mode 100644
index 0000000..c8cfbb3
--- /dev/null
+++ b/tests/expected/getopt/options-long_option_ambiguous_1
@@ -0,0 +1,3 @@
+getopt: option '--long' is ambiguous; possibilities: '--long1' '--long2'
+ --
+exit value: 1
diff --git a/tests/expected/getopt/options-longopts b/tests/expected/getopt/options-longopts
new file mode 100644
index 0000000..8ee9953
--- /dev/null
+++ b/tests/expected/getopt/options-longopts
@@ -0,0 +1,2 @@
+ --long1 --thirdlong 'ARGUMENT' --secondlong 'ARG' --abbreviation 'ABBRARG' -a -- 'EXTRA1'
+exit value: 0
diff --git a/tests/expected/getopt/options-name_option_long b/tests/expected/getopt/options-name_option_long
new file mode 100644
index 0000000..60b9e6b
--- /dev/null
+++ b/tests/expected/getopt/options-name_option_long
@@ -0,0 +1,4 @@
+THIS_PROGRAM: invalid option -- 'b'
+THIS_PROGRAM: unrecognized option '--whatever'
+ --long -a --
+exit value: 1
diff --git a/tests/expected/getopt/options-name_option_short b/tests/expected/getopt/options-name_option_short
new file mode 100644
index 0000000..60b9e6b
--- /dev/null
+++ b/tests/expected/getopt/options-name_option_short
@@ -0,0 +1,4 @@
+THIS_PROGRAM: invalid option -- 'b'
+THIS_PROGRAM: unrecognized option '--whatever'
+ --long -a --
+exit value: 1
diff --git a/tests/expected/getopt/options-no-arguments b/tests/expected/getopt/options-no-arguments
new file mode 100644
index 0000000..f1ecc16
--- /dev/null
+++ b/tests/expected/getopt/options-no-arguments
@@ -0,0 +1,3 @@
+getopt: missing optstring argument
+Try 'getopt --help' for more information.
+exit value: 2
diff --git a/tests/expected/getopt/options-non-option b/tests/expected/getopt/options-non-option
new file mode 100644
index 0000000..73f0b65
--- /dev/null
+++ b/tests/expected/getopt/options-non-option
@@ -0,0 +1,4 @@
+ -a 'x' -- 'y' '-b' 'z' 'w'
+ -a 'x' -b 'z' -- 'y' 'w'
+ -a 'x' 'y' -b 'z' 'w' --
+exit value: 0
diff --git a/tests/expected/getopt/options-posix_correctly b/tests/expected/getopt/options-posix_correctly
new file mode 100644
index 0000000..5b2bc33
--- /dev/null
+++ b/tests/expected/getopt/options-posix_correctly
@@ -0,0 +1,4 @@
+ -a -b '1' -c '2' --a-long --b-long '3' --c-long '' -- 'foo' 'bar' 'xyxxy' '--a-long'
+exit value: 0
+ -a -b '1' -c '2' --a-long --b-long '3' --c-long '' -- 'foo' 'bar' 'xyxxy' '--a-long'
+exit value: 0
diff --git a/tests/expected/getopt/options-quiet_option_long b/tests/expected/getopt/options-quiet_option_long
new file mode 100644
index 0000000..3e1a967
--- /dev/null
+++ b/tests/expected/getopt/options-quiet_option_long
@@ -0,0 +1,2 @@
+ --
+exit value: 1
diff --git a/tests/expected/getopt/options-quiet_option_short b/tests/expected/getopt/options-quiet_option_short
new file mode 100644
index 0000000..3e1a967
--- /dev/null
+++ b/tests/expected/getopt/options-quiet_option_short
@@ -0,0 +1,2 @@
+ --
+exit value: 1
diff --git a/tests/expected/getopt/options-quiet_output_option_long b/tests/expected/getopt/options-quiet_output_option_long
new file mode 100644
index 0000000..3e05ca7
--- /dev/null
+++ b/tests/expected/getopt/options-quiet_output_option_long
@@ -0,0 +1,5 @@
+getopt: invalid option -- 'c'
+getopt: unrecognized option '--unknown'
+getopt: option '--long' is ambiguous; possibilities: '--long1' '--long2'
+getopt: option requires an argument -- 'b'
+exit value: 1
diff --git a/tests/expected/getopt/options-quiet_output_option_short b/tests/expected/getopt/options-quiet_output_option_short
new file mode 100644
index 0000000..3e05ca7
--- /dev/null
+++ b/tests/expected/getopt/options-quiet_output_option_short
@@ -0,0 +1,5 @@
+getopt: invalid option -- 'c'
+getopt: unrecognized option '--unknown'
+getopt: option '--long' is ambiguous; possibilities: '--long1' '--long2'
+getopt: option requires an argument -- 'b'
+exit value: 1
diff --git a/tests/expected/getopt/options-same_long_short_options b/tests/expected/getopt/options-same_long_short_options
new file mode 100644
index 0000000..919d227
--- /dev/null
+++ b/tests/expected/getopt/options-same_long_short_options
@@ -0,0 +1,2 @@
+ -a --a --
+exit value: 0
diff --git a/tests/expected/getopt/options-sh b/tests/expected/getopt/options-sh
new file mode 100644
index 0000000..86e48f4
--- /dev/null
+++ b/tests/expected/getopt/options-sh
@@ -0,0 +1,2 @@
+ -a -b '1' -c '2' --a-long --b-long '3' --c-long '' -- 'foo' 'bar'
+exit value: 0
diff --git a/tests/expected/getopt/options-test_for_enhanced_getopt b/tests/expected/getopt/options-test_for_enhanced_getopt
new file mode 100644
index 0000000..539db06
--- /dev/null
+++ b/tests/expected/getopt/options-test_for_enhanced_getopt
@@ -0,0 +1 @@
+exit value: 4
diff --git a/tests/expected/getopt/options-unknown_options b/tests/expected/getopt/options-unknown_options
new file mode 100644
index 0000000..6edba2b
--- /dev/null
+++ b/tests/expected/getopt/options-unknown_options
@@ -0,0 +1,4 @@
+getopt: invalid option -- 'b'
+getopt: unrecognized option '--whatever'
+ --long -a --
+exit value: 1
diff --git a/tests/expected/getopt/options-unquoted_option_bash b/tests/expected/getopt/options-unquoted_option_bash
new file mode 100644
index 0000000..8da362f
--- /dev/null
+++ b/tests/expected/getopt/options-unquoted_option_bash
@@ -0,0 +1,5 @@
+ -a $?!* --long1 "\' -- More
+ than
+one
+line
+exit value: 0
diff --git a/tests/expected/getopt/options-unquoted_option_tcsh b/tests/expected/getopt/options-unquoted_option_tcsh
new file mode 100644
index 0000000..8da362f
--- /dev/null
+++ b/tests/expected/getopt/options-unquoted_option_tcsh
@@ -0,0 +1,5 @@
+ -a $?!* --long1 "\' -- More
+ than
+one
+line
+exit value: 0
diff --git a/tests/expected/getopt/options-weird_quoting_bash b/tests/expected/getopt/options-weird_quoting_bash
new file mode 100644
index 0000000..db871ce
--- /dev/null
+++ b/tests/expected/getopt/options-weird_quoting_bash
@@ -0,0 +1,5 @@
+ -a '$?!* ' --long1 '"\'\''' -- 'More
+ than
+one
+line'
+exit value: 0
diff --git a/tests/expected/getopt/options-weird_quoting_tcsh b/tests/expected/getopt/options-weird_quoting_tcsh
new file mode 100644
index 0000000..9e5b71d
--- /dev/null
+++ b/tests/expected/getopt/options-weird_quoting_tcsh
@@ -0,0 +1,2 @@
+ -a '$?'\!'*'\ '' --long1 '"\\'\''' -- 'More\n'\ 'than\none\nline'
+exit value: 0