Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: > Amend a test added in 96e7225b310 (hook: add 'run' subcommand, > 2021-12-22) to use a for-loop instead of a copy/pasting the same test > for the four exit codes we test. > > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> > --- > t/t1800-hook.sh | 35 ++++++++++------------------------- > 1 file changed, 10 insertions(+), 25 deletions(-) > ... > +for code in 1 2 128 129 > +do > + test_expect_success "git hook run: exit code $code is passed along" ' > + write_script .git/hooks/test-hook <<-EOF && > + exit $code > + EOF > + > + test_expect_code $code git hook run test-hook > + ' > +done Looks good. Each being separate test_expect_success means we do not have to worry about breaking out of the loop upon a failure, which is much cleaner than I would have thought ;-) It also illustrates a good use of unquoted here document.