summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse-options.c2
-rwxr-xr-xt/t0040-parse-options.sh10
2 files changed, 12 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c
index 190899611e..850cfa78c9 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -393,6 +393,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
case -1:
return parse_options_usage(ctx, usagestr, options, 1);
case -2:
+ if (ctx->opt)
+ check_typos(arg + 1, options);
goto unknown;
}
if (ctx->opt)
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index a44bcb9b39..e3f354a45e 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -236,6 +236,16 @@ test_expect_success 'detect possible typos' '
test_cmp typo.err output.err
'
+cat > typo.err << EOF
+error: did you mean \`--ambiguous\` (with two dashes ?)
+EOF
+
+test_expect_success 'detect possible typos' '
+ test_must_fail test-parse-options -ambiguous > output 2> output.err &&
+ test ! -s output &&
+ test_cmp typo.err output.err
+'
+
cat > expect <<EOF
boolean: 0
integer: 0