]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/README
Merge branch 'ps/t7800-variable-interpolation-fix'
[thirdparty/git.git] / t / README
index 621d3b8c095441a8a8985b7f12363e26f8ab4d98..aae673d8af273525e1d99a0569fde577a9e3daec 100644 (file)
--- a/t/README
+++ b/t/README
@@ -724,6 +724,26 @@ The "do's:"
    Note that we still &&-chain the loop to propagate failures from
    earlier commands.
 
+ - Repeat tests with slightly different arguments in a loop.
+
+   In some cases it may make sense to re-run the same set of tests with
+   different options or commands to ensure that the command behaves
+   despite the different parameters. This can be achieved by looping
+   around a specific parameter:
+
+       for arg in '' "--foo"
+       do
+               test_expect_success "test command ${arg:-without arguments}" '
+                       command $arg
+               '
+       done
+
+   Note that while the test title uses double quotes ("), the test body
+   should continue to use single quotes (') to avoid breakage in case the
+   values contain e.g. quoting characters. The loop variable will be
+   accessible regardless of the single quotes as the test body is passed
+   to `eval`.
+
 
 And here are the "don'ts:"