git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/5] t/README: make the 'Skipping tests' section less confusing

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 27, 2018, 22:54 UTC
Message-ID
<20181127225445.30045-1-avarab@gmail.com>

I added this section in b5500d16cd ("t/README: Add a section about skipping tests", 2010-07-02), but apparently didn't notice that there was an existing "Skipping Tests" section added in fbd458a3f6 ("t/README: Add 'Skipping Tests' section below 'Running Tests'", 2008-06-20).

Then since 20873f45e7 ("t/README: Document the do's and don'ts of tests", 2010-07-02) and 0445e6f0a1 ("test-lib: '--run' to run only specific tests", 2014-04-30) we've started to refer to "Skipping tests" or "Skipping Tests" sections in prose elsewhere.

Let's clean up this confusion by renaming the section, and while we're at it improve the example. Usually we don't use the PERL prerequisite, and we should accurately describe why you'd want to use prerequisites, as opposed to GIT_SKIP_TESTS. So let's say "Tests that depend[...]" instead of "If you need to skip tests[...]" here.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/README | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/t/README b/t/README
index 28711cc508..b6ec28f634 100644
--- a/t/README
+++ b/t/README
@@ -494,7 +494,7 @@ And here are the "don'ts:"
 
    The harness will catch this as a programming error of the test.
    Use test_done instead if you need to stop the tests early (see
-   "Skipping tests" below).
+   "Using test prerequisites" below).
 
  - Don't use '! git cmd' when you want to make sure the git command
    exits with failure in a controlled way by calling "die()".  Instead,
@@ -587,28 +587,28 @@ And here are the "don'ts:"
    it'll complain if anything is amiss.
 
 
-Skipping tests
---------------
+Using test prerequisites
+------------------------
 
-If you need to skip tests you should do so by using the three-arg form
-of the test_* functions (see the "Test harness library" section
-below), e.g.:
+Tests that depend on something which may not be present on the system
+should use the three-arg form of the test_* functions (see the "Test
+harness library" section below), e.g.:
 
-    test_expect_success PERL 'I need Perl' '
-        perl -e "hlagh() if unf_unf()"
+    test_expect_success SYMLINKS 'setup' '
+        ln -s target link
     '
 
 The advantage of skipping tests like this is that platforms that don't
-have the PERL and other optional dependencies get an indication of how
+have the SYMLINKS and other optional dependencies get an indication of how
 many tests they're missing.
 
 If the test code is too hairy for that (i.e. does a lot of setup work
 outside test assertions) you can also skip all remaining tests by
 setting skip_all and immediately call test_done:
 
-	if ! test_have_prereq PERL
+	if ! test_have_prereq SYMLINKS
 	then
-	    skip_all='skipping perl interface tests, perl not available'
+	    skip_all="skipping symlink tests, the filesystem doesn't support it"
 	    test_done
 	fi
 
-- 
2.20.0.rc1.379.g1dd7ef354c
Next: Ævar Arnfjörð Bjarmason
Message 1 of 7 in “t/README: make the 'Skipping tests' section less confusing”
  1. 1/5 t/README: make the 'Skipping tests' section less confusingÆvar Arnfjörð Bjarmason, Nov 27, 2018
  2. 3/5 t/README: re-flow a paragraphÆvar Arnfjörð Bjarmason, Nov 27, 2018
  3. 4/5 test-lib: add more exhaustive GIT_SKIP_TESTS testingÆvar Arnfjörð Bjarmason, Nov 27, 2018
  4. 5/5 test-lib: add support for GIT_TODO_TESTSÆvar Arnfjörð Bjarmason, Nov 27, 2018
  5. Junio C HamanoNov 29, 2018
  6. SZEDER GáborDec 4, 2018
  7. 2/5 t/README: modernize description of GIT_SKIP_TESTSÆvar Arnfjörð Bjarmason, Nov 27, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.