X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;ds=sidebyside;f=t%2Ftest-lib.sh;h=afd3053f96b789a73274217b384d245583500c04;hb=9be3614eff36271d5f1cd460a568a219902cb044;hp=c1476f9a2391396a201a919025963b82f7e14217;hpb=42aac96763a72b5bac73d34640d3a0c6233027a6;p=git.git diff --git a/t/test-lib.sh b/t/test-lib.sh index c1476f9a2..afd3053f9 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -74,6 +74,12 @@ case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in ;; esac +# Convenience +# +# A regexp to match 5 and 40 hexdigits +_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' +_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05" + # Each test should start with something like this, after copyright notices: # # test_description='Description of this test... @@ -224,6 +230,22 @@ test_decode_color () { -e 's/.\[m//g' } +q_to_nul () { + perl -pe 'y/Q/\000/' +} + +q_to_cr () { + tr Q '\015' +} + +append_cr () { + sed -e 's/$/Q/' | tr Q '\015' +} + +remove_cr () { + tr '\015' Q | sed -e 's/Q$//' +} + test_tick () { if test -z "${test_tick+set}" then