On Fri, Mar 27, 2020 at 1:44 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > Subject: [PATCH] t/README: suggest how to leave test early with failure > + test_expect_success 'git frotz on various versions' ' > + for revision in one two three > + do > + echo "frotz $revision" >expect && > + git frotz "$revision" >actual && > + test_cmp expect actual || return 1 > + done && > + test something else > + ' > + > + Note that this is only possible in our test suite, where we > + arrange to run your test <script> wrapped inside a helper > + function to ensure that return values matter; in your own script > + outside any function, this technique may not work. > + > And here are the "don'ts:" > > - Don't exit() within a <script> part. We use 'exit 1' to terminate subshells[1] inside tests. [1]: https://lore.kernel.org/git/20150325052952.GE31924@xxxxxxxx/