[PATCH] Need to set PAGER in tests
[git.git] / t / test-lib.sh
index d3f71d1..5cdd41d 100755 (executable)
@@ -5,8 +5,9 @@
 
 # For repeatability, reset the environment to known value.
 LANG=C
+PAGER=cat
 TZ=UTC
-export LANG TZ
+export LANG PAGER TZ
 unset AUTHOR_DATE
 unset AUTHOR_EMAIL
 unset AUTHOR_NAME
@@ -84,17 +85,19 @@ test_ok_ () {
 test_failure_ () {
        test_count=$(expr "$test_count" + 1)
        test_failure=$(expr "$test_failure" + 1);
-       say "FAIL $test_count: $@"
-       test "$immediate" == "" || exit 1
+       say "FAIL $test_count: $1"
+       shift
+       echo "$@" | sed -e 's/^/        /'
+       test "$immediate" = "" || exit 1
 }
 
 
 test_debug () {
-       test "$debug" == "" || eval "$1"
+       test "$debug" = "" || eval "$1"
 }
 
 test_expect_failure () {
-       test "$#" == 2 ||
+       test "$#" = 2 ||
        error "bug in the test script: not 2 parameters to test-expect-failure"
        say >&3 "expecting failure: $2"
        if eval >&3 2>&4 "$2"
@@ -106,7 +109,7 @@ test_expect_failure () {
 }
 
 test_expect_success () {
-       test "$#" == 2 ||
+       test "$#" = 2 ||
        error "bug in the test script: not 2 parameters to test-expect-success"
        say >&3 "expecting success: $2"
        if eval >&3 2>&4 "$2"