]> asedeno.scripts.mit.edu Git - git.git/blobdiff - t/t0040-parse-options.sh
Add a test for git-add --ignore-errors
[git.git] / t / t0040-parse-options.sh
index 462fdf262fe451c14679753018a415e1cc778732..c23f0ace85c83f54fd7562d72af6ef6c1ea2eca3 100755 (executable)
@@ -19,6 +19,10 @@ string options
                           get a string
     --string2 <str>       get another string
     --st <st>             get another string (pervert ordering)
+    -o <str>              get another string
+
+magic arguments
+    --quux                means --quux
 
 EOF
 
@@ -86,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
@@ -103,4 +107,27 @@ test_expect_success 'non ambiguous option (after two options it abbreviates)' '
        git diff expect output
 '
 
+cat > expect.err << EOF
+error: did you mean \`--boolean\` (with two dashes ?)
+EOF
+
+test_expect_success 'detect possible typos' '
+       ! test-parse-options -boolean > output 2> output.err &&
+       test ! -s output &&
+       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