Code

Merge branch 'gp/gitweb'
[git.git] / t / t0040-parse-options.sh
index 0a3b55d1212ddeda87f1f3ffa4c4e2fbefb44553..c23f0ace85c83f54fd7562d72af6ef6c1ea2eca3 100755 (executable)
@@ -21,6 +21,9 @@ string options
     --st <st>             get another string (pervert ordering)
     -o <str>              get another string
 
+magic arguments
+    --quux                means --quux
+
 EOF
 
 test_expect_success 'test help' '
@@ -87,9 +90,9 @@ test_expect_success 'unambiguously abbreviated option with "="' '
        git diff expect output
 '
 
-test_expect_failure 'ambiguously abbreviated option' '
+test_expect_success 'ambiguously abbreviated option' '
        test-parse-options --strin 123;
-        test $? != 129
+       test $? = 129
 '
 
 cat > expect << EOF
@@ -114,4 +117,17 @@ test_expect_success 'detect possible typos' '
        git diff expect.err output.err
 '
 
+cat > expect <<EOF
+boolean: 0
+integer: 0
+string: (not set)
+arg 00: --quux
+EOF
+
+test_expect_success 'keep some options as arguments' '
+       test-parse-options --quux > output 2> output.err &&
+        test ! -s output.err &&
+        git diff expect output
+'
+
 test_done