Code

Merge branch 'tr/maint-bundle-long-subject' into maint-1.7.8
[git.git] / t / t0040-parse-options.sh
index ae266147b6db9e06abeb4dc30e4271b6c611deac..a1e4616febe6c67f67ab2b4380610abc92468ba5 100755 (executable)
@@ -28,6 +28,7 @@ String options
     --st <st>             get another string (pervert ordering)
     -o <str>              get another string
     --default-string      set string to default
+    --list <str>          add str to list
 
 Magic arguments
     --quux                means --quux
@@ -86,7 +87,7 @@ EOF
 test_expect_success 'long options' '
        test-parse-options --boolean --integer 1729 --boolean --string2=321 \
                --verbose --verbose --no-dry-run --abbrev=10 --file fi.le\
-               > output 2> output.err &&
+               --obsolete > output 2> output.err &&
        test ! -s output.err &&
        test_cmp expect output
 '
@@ -337,4 +338,20 @@ test_expect_success 'negation of OPT_NONEG flags is not ambiguous' '
        test_cmp expect output
 '
 
+cat >>expect <<'EOF'
+list: foo
+list: bar
+list: baz
+EOF
+test_expect_success '--list keeps list of strings' '
+       test-parse-options --list foo --list=bar --list=baz >output &&
+       test_cmp expect output
+'
+
+test_expect_success '--no-list resets list' '
+       test-parse-options --list=other --list=irrelevant --list=options \
+               --no-list --list=foo --list=bar --list=baz >output &&
+       test_cmp expect output
+'
+
 test_done