Commit graph

9 commits

Author SHA1 Message Date
Junio C Hamano 41ac414ea2 Sane use of test_expect_failure
Originally, test_expect_failure was designed to be the opposite
of test_expect_success, but this was a bad decision.  Most tests
run a series of commands that leads to the single command that
needs to be tested, like this:

    test_expect_{success,failure} 'test title' '
	setup1 &&
        setup2 &&
        setup3 &&
        what is to be tested
    '

And expecting a failure exit from the whole sequence misses the
point of writing tests.  Your setup$N that are supposed to
succeed may have failed without even reaching what you are
trying to test.  The only valid use of test_expect_failure is to
check a trivial single command that is expected to fail, which
is a minority in tests of Porcelain-ish commands.

This large-ish patch rewrites all uses of test_expect_failure to
use test_expect_success and rewrites the condition of what is
tested, like this:

    test_expect_success 'test title' '
	setup1 &&
        setup2 &&
        setup3 &&
        ! this command should fail
    '

test_expect_failure is redefined to serve as a reminder that
that test *should* succeed but due to a known breakage in git it
currently does not pass.  So if git-foo command should create a
file 'bar' but you discovered a bug that it doesn't, you can
write a test like this:

    test_expect_failure 'git-foo should create bar' '
        rm -f bar &&
        git foo &&
        test -f bar
    '

This construct acts similar to test_expect_success, but instead
of reporting "ok/FAIL" like test_expect_success does, the
outcome is reported as "FIXED/still broken".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-01 20:49:34 -08:00
Nicolas Pitre 5c94f87e6b use 'init' instead of 'init-db' for shipped docs and tools
While 'init-db' still is and probably will always remain a valid git
command for obvious backward compatibility reasons, it would be a good
idea to move shipped tools and docs to using 'init' instead.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-12 13:36:16 -08:00
Jakub Narebski 8757749ecb Add info about new test families (8 and 9) to t/README
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-29 09:49:12 -08:00
Junio C Hamano 8f4a9b62ee t/README: start testing porcelainish
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 11:45:52 -07:00
Junio C Hamano 215a7ad1ef Big tool rename.
As promised, this is the "big tool rename" patch.  The primary differences
since 0.99.6 are:

  (1) git-*-script are no more.  The commands installed do not
      have any such suffix so users do not have to remember if
      something is implemented as a shell script or not.

  (2) Many command names with 'cache' in them are renamed with
      'index' if that is what they mean.

There are backward compatibility symblic links so that you and
Porcelains can keep using the old names, but the backward
compatibility support  is expected to be removed in the near
future.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-07 17:45:20 -07:00
Junio C Hamano 776566000f [PATCH] Prevent t6000 series from dropping useless sed.script in t/
The Makefile in the test suite directory considers any file
matching t[0-9][0-9][0-9][0-9]-*.sh as the top-level test script
to be executed.  Unfortunately this was not documented, and the
common test library, t6000-lib.sh was named to match that
pattern.  This caused t6000-lib.sh to be called from Makefile as
the top-level program, causing it to leave t/sed.script file
behind.  Rename it to t6000lib.sh to prevent this, and document
the naming convention a bit more clearly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 15:53:35 -07:00
Junio C Hamano 14cd1ff396 [PATCH 4/4] Trivial test harness fixes.
The documentation of the test harness still refer to old
numbering and also contains an obvious typo.

Also "make test" should be run after making sure we have built
all binaries, since test is designed to test the newly built
ones.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-16 00:22:10 +02:00
Petr Baudis f50c9f76ca Rename some test scripts and describe the naming convention
First digit: "family", e.g. the absolute basics and global stuff (0),
the basic db-side commands (read-tree, write-tree, commit-tree), the
basic working-tree-side commands (checkout-cache, update-cache), the
other basic commands (ls-files), the diff commands, the pull commands,
exporting commands, revision tree commands...

Second digit: the particular command we are testing

Third digit: (optionally) the particular switch or group of switches
we are testing

Freeform part: commandname-details

Described in the README.

	mv t1000-checkout-cache.sh t2000-checkout-cache-clash.sh
	mv t1001-checkout-cache.sh t2001-checkout-cache-clash.sh
	mv t0200-update-cache.sh t2010-update-cache-badpath.sh
	mv t0400-ls-files.sh t3000-ls-files-others.sh
	mv t0500-ls-files.sh t3010-ls-files-killed.sh
2005-05-15 01:34:22 +02:00
Junio C Hamano 986aa7f17e [PATCH 2/2] Test framework documentation.
This adds instruction for running tests, and writing new tests.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Updated to the new tidied up output style.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-14 18:14:45 +02:00