tests: consolidate CR removal/addition functions

append_cr(), remove_cr(), q_to_nul() and q_to_cr() are defined in multiple
tests. Consolidate them into test-lib.sh so we can stop redefining them.
The use of remove_cr() in t0020 to test for a CR is replaced with a new
function has_cr() to accurately reflect what is intended (the output of
remove_cr() was being thrown away).

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stephen Boyd
2010-01-25 16:33:57 -08:00
committed by Junio C Hamano
parent 2d7f98bac7
commit c4f3f551a6
6 changed files with 37 additions and 58 deletions

View File

@ -77,10 +77,6 @@ test_expect_success 'apply binary patch' \
tree1=`git write-tree` &&
test "$tree1" = "$tree0"'
q_to_nul() {
perl -pe 'y/Q/\000/'
}
nul_to_q() {
perl -pe 'y/\000/Q/'
}