From: Junio C Hamano Date: Thu, 21 Aug 2008 06:40:59 +0000 (-0700) Subject: Merge branch 'jc/test-deeper' X-Git-Tag: v1.6.1-rc1~335 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f02fa3360510c6a2b75d2b52b8d1636788ab2605?hp=-c Merge branch 'jc/test-deeper' * jc/test-deeper: tests: use $TEST_DIRECTORY to refer to the t/ directory --- f02fa3360510c6a2b75d2b52b8d1636788ab2605 diff --combined t/t4015-diff-whitespace.sh index ec98509fd2,6110566aaa..f9eb67d835 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@@ -7,7 -7,7 +7,7 @@@ test_description='Test special whitespa ' . ./test-lib.sh - . ../diff-lib.sh + . "$TEST_DIRECTORY"/diff-lib.sh # Ray Lehtiniemi's example @@@ -341,15 -341,4 +341,15 @@@ test_expect_success 'checkdiff detects git diff --check | grep "ends with blank" ' +test_expect_success 'checkdiff allows new blank lines' ' + git checkout x && + mv x y && + ( + echo "/* This is new */" && + echo "" && + cat y + ) >x && + git diff --check +' + test_done diff --combined t/t5100-mailinfo.sh index 198e3503d5,3b6c3a9d97..fe14589427 --- a/t/t5100-mailinfo.sh +++ b/t/t5100-mailinfo.sh @@@ -8,27 -8,28 +8,28 @@@ test_description='git mailinfo and git . ./test-lib.sh test_expect_success 'split sample box' \ - 'git mailsplit -o. ../t5100/sample.mbox >last && + 'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last && last=`cat last` && echo total is $last && test `cat last` = 11' for mail in `echo 00*` do - test_expect_success "mailinfo $mail" \ - "git mailinfo -u msg$mail patch$mail <$mail >info$mail && + test_expect_success "mailinfo $mail" ' + git mailinfo -u msg$mail patch$mail <$mail >info$mail && echo msg && - diff ../t5100/msg$mail msg$mail && + test_cmp "$TEST_DIRECTORY"/t5100/msg$mail msg$mail && echo patch && - diff ../t5100/patch$mail patch$mail && + test_cmp "$TEST_DIRECTORY"/t5100/patch$mail patch$mail && echo info && - diff ../t5100/info$mail info$mail" + test_cmp "$TEST_DIRECTORY"/t5100/info$mail info$mail + ' done test_expect_success 'respect NULs' ' - git mailsplit -d3 -o. ../t5100/nul-plain && - cmp ../t5100/nul-plain 001 && + git mailsplit -d3 -o. "$TEST_DIRECTORY"/t5100/nul-plain && + test_cmp "$TEST_DIRECTORY"/t5100/nul-plain 001 && (cat 001 | git mailinfo msg patch) && test 4 = $(wc -l < patch) @@@ -36,22 -37,11 +37,22 @@@ test_expect_success 'Preserve NULs out of MIME encoded message' ' - git mailsplit -d5 -o. ../t5100/nul-b64.in && - cmp ../t5100/nul-b64.in 00001 && + git mailsplit -d5 -o. "$TEST_DIRECTORY"/t5100/nul-b64.in && + test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.in 00001 && git mailinfo msg patch <00001 && - cmp ../t5100/nul-b64.expect patch + test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.expect patch ' +test_expect_success 'mailinfo on from header without name works' ' + + mkdir info-from && + git mailsplit -oinfo-from "$TEST_DIRECTORY"/t5100/info-from.in && + test_cmp "$TEST_DIRECTORY"/t5100/info-from.in info-from/0001 && + git mailinfo info-from/msg info-from/patch \ + info-from/out && + test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out + +' + test_done diff --combined t/test-lib.sh index 7f60b614ea,70ea7e089e..6212c46cc1 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -406,7 -406,7 +406,7 @@@ test_create_repo () error "bug in the test script: not 1 parameter to test-create-repo" owd=`pwd` repo="$1" - mkdir "$repo" + mkdir -p "$repo" cd "$repo" || error "Cannot setup test environment" "$GIT_EXEC_PATH/git" init "--template=$GIT_EXEC_PATH/templates/blt/" >&3 2>&4 || error "cannot run git init -- have you built things yet?" @@@ -449,11 -449,6 +449,11 @@@ test_done () # we will leave things as they are. say_color pass "passed all $msg" + + test -d "$remove_trash" && + cd "$(dirname "$remove_trash")" && + rm -rf "$(basename "$remove_trash")" + exit 0 ;; *) @@@ -490,8 -485,7 +490,8 @@@ f . ../GIT-BUILD-OPTIONS # Test repository -test="trash directory" +test="trash directory.$(basename "$0" .sh)" +remove_trash="$TEST_DIRECTORY/$test" rm -fr "$test" || { trap - exit echo >&5 "FATAL: Cannot prepare test area"