Subject: Re: [RFC/PATCH v2] t3300-*.sh: Fix a TAP parse error

From: Ramsay Jones <[email-masked]>
Date: Wed, 25 Jul 2012 20:46:53 +0100

Jonathan Nieder wrote:
>> This version of the patch only moves code to determine the test
>> prerequisite to the outer level, while leaving the 'setup' aspects
>> of the first test in place.
> 
> I guess I don't see the point.

You don't see the point of fixing the TAP Parse error? :-D

>                                The current convention of "don't do
> anything complicated outside test assertions" is easy to explain.
> What new convention are you suggesting to replace it?

Hmm, well I guess I'm not going to suggest anything!

However, what is "anything complicated"?

At the end of test-lib.sh we find:

    # test whether the filesystem supports symbolic links
    ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
    rm -f y

    # When the tests are run as root, permission tests will report that
    # things are writable when they shouldn't be.
    test -w / || test_set_prereq SANITY

Is this too complicated? If not, why not? If yes, should it be added to
a test assertion?

Would it be acceptable for me to add some code, here at the end of
test-lib.sh, to set the TABS_IN_FILENAME test prerequisite and use it
in tests t3300-funny-names.sh, t3902-quoted.sh, t3600-rm.sh,
t4016-diff-quote.sh and t4135-apply-weird-filenames.sh?

How about some of the test "library" files:

diff-lib.sh              lib-git-p4.sh            lib-read-tree.sh
gitweb-lib.sh            lib-git-svn.sh           lib-rebase.sh
lib-bash.sh              lib-gpg.sh*              lib-t6000.sh
lib-credential.sh*       lib-httpd.sh             lib-terminal.sh
lib-cvs.sh               lib-pager.sh             test-lib-functions.sh
lib-diff-alternative.sh  lib-patch-mode.sh        test-lib.sh
lib-gettext.sh           lib-prereq-FILEMODE.sh
lib-git-daemon.sh        lib-read-tree-m-3way.sh

Several of these files contain executable code (rather than just a
library of functions). For example, look at lib-cvs.sh, lib-httpd.sh,
and lib-prereq-FILEMODE.sh. Is this code too complicated?

Would it be acceptable for me to create an lib-prereq-TABSINFILE.sh
file so that I could source it only in the test files that require
the TABS_IN_FILENAME prerequisite?

ATB,
Ramsay Jones