Merge branch 'jn/userdiff-perl-updates'
authorJunio C Hamano <gitster@pobox.com>
Thu, 26 May 2011 17:32:25 +0000 (10:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 May 2011 17:32:25 +0000 (10:32 -0700)
* jn/userdiff-perl-updates:
userdiff/perl: tighten BEGIN/END block pattern to reject here-doc delimiters
tests: make test_expect_code quieter on success
userdiff/perl: catch sub with brace on second line
userdiff/perl: match full line of POD headers
userdiff/perl: anchor "sub" and "package" patterns on the left
t4018 (funcname patterns): minor cleanups
t4018 (funcname patterns): make configuration easier to track
t4018 (funcname patterns): make .gitattributes state easier to track

1  2 
t/test-lib.sh
diff --combined t/test-lib.sh
index b2ce2bc4b22f43c0b324ab3f596a7f865fa58cc1,a174f66961e2cc526c6500e62714c829431bd025..b12b993e9a9299ff865ef6f1b8770d503988d53b
@@@ -578,7 -578,7 +578,7 @@@ test_external () 
  test_external_without_stderr () {
        # The temporary file has no (and must have no) security
        # implications.
 -      tmp="$TMPDIR"; if [ -z "$tmp" ]; then tmp=/tmp; fi
 +      tmp=${TMPDIR:-/tmp}
        stderr="$tmp/git-external-stderr.$$.tmp"
        test_external "$@" 4> "$stderr"
        [ -f "$stderr" ] || error "Internal error: $stderr disappeared."
@@@ -731,12 -731,11 +731,11 @@@ test_expect_code () 
        exit_code=$?
        if test $exit_code = $want_code
        then
-               echo >&2 "test_expect_code: command exited with $exit_code: $*"
                return 0
-       else
-               echo >&2 "test_expect_code: command exited with $exit_code, we wanted $want_code $*"
-               return 1
        fi
+       echo >&2 "test_expect_code: command exited with $exit_code, we wanted $want_code $*"
+       return 1
  }
  
  # test_cmp is a helper function to compare actual and expected output.
@@@ -804,14 -803,12 +803,14 @@@ test_done () 
                mkdir -p "$test_results_dir"
                test_results_path="$test_results_dir/${0%.sh}-$$.counts"
  
 -              echo "total $test_count" >> $test_results_path
 -              echo "success $test_success" >> $test_results_path
 -              echo "fixed $test_fixed" >> $test_results_path
 -              echo "broken $test_broken" >> $test_results_path
 -              echo "failed $test_failure" >> $test_results_path
 -              echo "" >> $test_results_path
 +              cat >>"$test_results_path" <<-EOF
 +              total $test_count
 +              success $test_success
 +              fixed $test_fixed
 +              broken $test_broken
 +              failed $test_failure
 +
 +              EOF
        fi
  
        if test "$test_fixed" != 0
        test_set_prereq C_LOCALE_OUTPUT
  fi
  
 +# Use this instead of test_cmp to compare files that contain expected and
 +# actual output from git commands that can be translated.  When running
 +# under GETTEXT_POISON this pretends that the command produced expected
 +# results.
 +test_i18ncmp () {
 +      test -n "$GETTEXT_POISON" || test_cmp "$@"
 +}
 +
 +# Use this instead of "grep expected-string actual" to see if the
 +# output from a git command that can be translated either contains an
 +# expected string, or does not contain an unwanted one.  When running
 +# under GETTEXT_POISON this pretends that the command produced expected
 +# results.
 +test_i18ngrep () {
 +      if test -n "$GETTEXT_POISON"
 +      then
 +          : # pretend success
 +      elif test "x!" = "x$1"
 +      then
 +              shift
 +              ! grep "$@"
 +      else
 +              grep "$@"
 +      fi
 +}
 +
  # 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