]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/test-lib-functions.sh
test-lib-functions: remove bug-inducing "diagnostics" helper param
[thirdparty/git.git] / t / test-lib-functions.sh
index c31a4113727a2484081c81360dcf38ab9b5c3c1b..109d1b548ce4ed4798e332fa31ddc404e1b49fc0 100644 (file)
@@ -32,11 +32,6 @@ test_set_editor () {
        export EDITOR
 }
 
-test_set_index_version () {
-    GIT_INDEX_VERSION="$1"
-    export GIT_INDEX_VERSION
-}
-
 test_decode_color () {
        awk '
                function name(n) {
@@ -116,13 +111,6 @@ remove_cr () {
        tr '\015' Q | sed -e 's/Q$//'
 }
 
-# Generate an output of $1 bytes of all zeroes (NULs, not ASCII zeroes).
-# If $1 is 'infinity', output forever or until the receiving pipe stops reading,
-# whichever comes first.
-generate_zero_bytes () {
-       test-tool genzeros "$@"
-}
-
 # In some bourne shell implementations, the "unset" builtin returns
 # nonzero status when a variable to be unset was not set in the first
 # place.
@@ -188,8 +176,8 @@ debug () {
 #      "<file>"
 #   --signoff
 #      Invoke "git commit" with --signoff
-#   --author=<author>
-#      Invoke "git commit" with --author=<author>
+#   --author <author>
+#      Invoke "git commit" with --author <author>
 #
 # This will commit a file with the given contents and the given commit
 # message, and tag the resulting commit with the given tag name.
@@ -729,12 +717,12 @@ test_external_without_stderr () {
 }
 
 # debugging-friendly alternatives to "test [-f|-d|-e]"
-# The commands test the existence or non-existence of $1. $2 can be
-# given to provide a more precise diagnosis.
+# The commands test the existence or non-existence of $1
 test_path_is_file () {
+       test "$#" -ne 1 && BUG "1 param"
        if ! test -f "$1"
        then
-               echo "File $1 doesn't exist. $2"
+               echo "File $1 doesn't exist"
                false
        fi
 }
@@ -742,15 +730,16 @@ test_path_is_file () {
 test_path_is_dir () {
        if ! test -d "$1"
        then
-               echo "Directory $1 doesn't exist. $2"
+               echo "Directory $1 doesn't exist"
                false
        fi
 }
 
 test_path_exists () {
+       test "$#" -ne 1 && BUG "1 param"
        if ! test -e "$1"
        then
-               echo "Path $1 doesn't exist. $2"
+               echo "Path $1 doesn't exist"
                false
        fi
 }
@@ -1105,7 +1094,7 @@ test_cmp_rev () {
        fi
        if test $# != 2
        then
-               error "bug in the test script: test_cmp_rev requires two revisions, but got $#"
+               BUG "test_cmp_rev requires two revisions, but got $#"
        else
                local r1 r2
                r1=$(git rev-parse --verify "$1") &&
@@ -1216,7 +1205,7 @@ test_atexit () {
        # doing so on Bash is better than nothing (the test will
        # silently pass on other shells).
        test "${BASH_SUBSHELL-0}" = 0 ||
-       error "bug in test script: test_atexit does nothing in a subshell"
+       BUG "test_atexit does nothing in a subshell"
        test_atexit_cleanup="{ $*
                } && (exit \"\$eval_ret\"); eval_ret=\$?; $test_atexit_cleanup"
 }
@@ -1614,33 +1603,6 @@ test_set_port () {
        eval $var=$port
 }
 
-# Compare a file containing rev-list bitmap traversal output to its non-bitmap
-# counterpart. You can't just use test_cmp for this, because the two produce
-# subtly different output:
-#
-#   - regular output is in traversal order, whereas bitmap is split by type,
-#     with non-packed objects at the end
-#
-#   - regular output has a space and the pathname appended to non-commit
-#     objects; bitmap output omits this
-#
-# This function normalizes and compares the two. The second file should
-# always be the bitmap output.
-test_bitmap_traversal () {
-       if test "$1" = "--no-confirm-bitmaps"
-       then
-               shift
-       elif cmp "$1" "$2"
-       then
-               echo >&2 "identical raw outputs; are you sure bitmaps were used?"
-               return 1
-       fi &&
-       cut -d' ' -f1 "$1" | sort >"$1.normalized" &&
-       sort "$2" >"$2.normalized" &&
-       test_cmp "$1.normalized" "$2.normalized" &&
-       rm -f "$1.normalized" "$2.normalized"
-}
-
 # Tests for the hidden file attribute on Windows
 test_path_is_hidden () {
        test_have_prereq MINGW ||