From: Aaron Plattner Date: Wed, 11 Mar 2026 17:01:55 GMT Subject: Re: [PATCH 5/5] help: add tests for subcommand autocorrection Message-ID: <7caf4a0f-f11c-4a4f-864a-933142311a68@nvidia.com> In-Reply-To: On 3/8/26 5:17 AM, Jiamu Sun wrote: > These tests cover default behavior (help.autocorrect is unset), no > correction, immediate correction, delayed correction, and rejection > when the typo is too dissimilar. > > Signed-off-by: Jiamu Sun <39@barroit.sh> > --- > t/t9004-autocorrect-subcommand.sh | 49 +++++++++++++++++++++++++++++++ > 1 file changed, 49 insertions(+) > create mode 100755 t/t9004-autocorrect-subcommand.sh Adding this causes meson setup to fail: t/meson.build:1193:6: ERROR: Problem encountered: Test files found, but not configured: - t9004-autocorrect-subcommand.sh I think you just need to add it to meson.build: diff --git a/t/meson.build b/t/meson.build index f66a73f8a0..bf0503d705 100644 --- a/t/meson.build +++ b/t/meson.build @@ -973,6 +973,7 @@ integration_tests = [ 't9001-send-email.sh', 't9002-column.sh', 't9003-help-autocorrect.sh', + 't9004-autocorrect-subcommand.sh', 't9100-git-svn-basic.sh', 't9101-git-svn-props.sh', 't9102-git-svn-deep-rmdir.sh', -- Aaron > > diff --git a/t/t9004-autocorrect-subcommand.sh b/t/t9004-autocorrect-subcommand.sh > new file mode 100755 > index 000000000000..760760c8851a > --- /dev/null > +++ b/t/t9004-autocorrect-subcommand.sh > @@ -0,0 +1,49 @@ > +#!/bin/sh > + > +test_description='subcommand auto-correction test > + > +Test autocorrection for subcommands with different > +help.autocorrect mode.' > + > +. ./test-lib.sh > + > +test_expect_success 'setup' " > + echo '^error: unknown subcommand: ' >grep_unknown > +" > + > +test_expect_success 'default is not to autocorrect' ' > + test_must_fail git worktree lsit 2>actual && > + head -n1 actual >first && test_grep -f grep_unknown first > +' > + > +for mode in false no off 0 show never; do > + test_expect_success "'$mode' disables autocorrection" " > + test_config help.autocorrect $mode && > + > + test_must_fail git worktree lsit 2>actual && > + head -n1 actual >first && test_grep -f grep_unknown first > + " > +done > + > +for mode in -39 immediate 1; do > + test_expect_success "autocorrect immediately with '$mode'" - <<-EOT > + test_config help.autocorrect $mode && > + > + git worktree lsit 2>actual && > + test_grep "you meant 'list'\.$" actual > + EOT > +done > + > +test_expect_success 'delay path is executed' - <<-\EOT > + test_config help.autocorrect 2 && > + > + git worktree lsit 2>actual && > + test_grep '^Continuing in 0.2 seconds, ' actual > +EOT > + > +test_expect_success 'deny if too dissimilar' - <<-\EOT > + test_must_fail git remote rensnr 2>actual && > + head -n1 actual >first && test_grep -f grep_unknown first > +EOT > + > +test_done