3 # Copyright (c) 2005 Junio C Hamano
6 # For repeatability, reset the environment to known value.
13 unset COMMIT_AUTHOR_EMAIL
14 unset COMMIT_AUTHOR_NAME
15 unset GIT_ALTERNATE_OBJECT_DIRECTORIES
17 unset GIT_AUTHOR_EMAIL
19 unset GIT_COMMITTER_EMAIL
20 unset GIT_COMMITTER_NAME
23 unset GIT_EXTERNAL_DIFF
25 unset GIT_OBJECT_DIRECTORY
26 unset SHA1_FILE_DIRECTORIES
27 unset SHA1_FILE_DIRECTORY
29 # Each test should start with something like this, after copyright notices:
31 # test_description='Description of this test...
32 # This test checks if command xyzzy does the right thing...
45 test "${test_description}" != "" ||
46 error
"Test script did not set test_description."
51 -d|
--d|
--de|
--deb|
--debu|
--debug)
53 -i|
--i|
--im|
--imm|
--imme|
--immed|
--immedi|
--immedia|
--immediat|
--immediate)
55 -h|
--h|
--he|
--hel|
--help)
56 echo "$test_description"
58 -v|
--v|
--ve|
--ver|
--verb|
--verbo|
--verbos|
--verbose)
65 if test "$verbose" = "t"
69 exec 4>/dev
/null
3>/dev
/null
76 # You are not expected to call test_ok_ and test_failure_ directly, use
77 # the text_expect_* functions instead.
80 test_count
=$
(expr "$test_count" + 1)
81 say
" ok $test_count: $@"
85 test_count
=$
(expr "$test_count" + 1)
86 test_failure
=$
(expr "$test_failure" + 1);
87 say
"FAIL $test_count: $1"
89 echo "$@" |
sed -e 's/^/ /'
90 test "$immediate" == "" ||
exit 1
95 test "$debug" == "" ||
eval "$1"
98 test_expect_failure
() {
100 error
"bug in the test script: not 2 parameters to test-expect-failure"
101 say
>&3 "expecting failure: $2"
102 if eval >&3 2>&4 "$2"
110 test_expect_success
() {
112 error
"bug in the test script: not 2 parameters to test-expect-success"
113 say
>&3 "expecting success: $2"
114 if eval >&3 2>&4 "$2"
123 case "$test_failure" in
126 # cd .. && rm -fr trash
127 # but that means we forbid any tests that use their own
128 # subdirectory from calling test_done without coming back
129 # to where they started from.
130 # The Makefile provided will clean this test area so
131 # we will leave things as they are.
133 say
"passed all $test_count test(s)"
137 say
"failed $test_failure among $test_count test(s)"
143 # Test the binaries we have just built. The tests are kept in
144 # t/ subdirectory and are run in trash subdirectory.
152 git-init-db
2>/dev
/null || error
"cannot run git-init-db"