]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t0000-basic.sh
t: add test_oid option to select hash algorithm
[thirdparty/git.git] / t / t0000-basic.sh
index 2ff176cd5d954cb1c83f062adbdb28a7e14d2668..2599d026a220d545a0617a80687c2e301073e583 100755 (executable)
@@ -928,6 +928,17 @@ test_expect_success 'test_oid can look up data for SHA-256' '
        test "$hexsz" -eq 64
 '
 
+test_expect_success 'test_oid can look up data for a specified algorithm' '
+       rawsz="$(test_oid --hash=sha1 rawsz)" &&
+       hexsz="$(test_oid --hash=sha1 hexsz)" &&
+       test "$rawsz" -eq 20 &&
+       test "$hexsz" -eq 40 &&
+       rawsz="$(test_oid --hash=sha256 rawsz)" &&
+       hexsz="$(test_oid --hash=sha256 hexsz)" &&
+       test "$rawsz" -eq 32 &&
+       test "$hexsz" -eq 64
+'
+
 test_expect_success 'test_bool_env' '
        (
                sane_unset envvar &&