Merge branch 'jc/test-deeper'
authorJunio C Hamano <gitster@pobox.com>
Thu, 21 Aug 2008 06:40:59 +0000 (23:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Aug 2008 06:40:59 +0000 (23:40 -0700)
* jc/test-deeper:
tests: use $TEST_DIRECTORY to refer to the t/ directory

1  2 
t/t4015-diff-whitespace.sh
t/t5100-mailinfo.sh
t/test-lib.sh
index ec98509fd2144121e599edd6a85217840041f321,6110566aaa5e0974c1f034ea7c8601ae43daa0db..f9eb67d8351e608ec213a330f63a94ac0d3b81be
@@@ -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 198e3503d53c109e5090e213914ee23360c06902,3b6c3a9d975505611780dfa333a62ae9b5021a0a..fe14589427643b9bb7759c597935da724adf1a64
@@@ -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)
  
  
  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/0001 >info-from/out &&
 +      test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out
 +
 +'
 +
  test_done
diff --combined t/test-lib.sh
index 7f60b614eafb3da9f481e1c7df38f9d8fbfeb076,70ea7e089e21b1619d85b6ccfe9e70b8f11421ff..6212c46cc1d73695790e7888c0640fe629210abe
@@@ -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"