diff options
| author | Stephen Boyd <bebarino@gmail.com> | 2010-01-25 16:33:57 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2010-01-25 16:42:23 -0800 |
| commit | c4f3f551a61e138f8ace9523d6b16aff37b30302 (patch) | |
| tree | 839c322653b2f465367f433b8cdca1e51af99081 /t/test-lib.sh | |
| parent | 2d7f98bac7e1d8b42c558e179ea24f5b06512622 (diff) | |
| download | git-c4f3f551a61e138f8ace9523d6b16aff37b30302.tar.gz | |
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>
Diffstat (limited to 't/test-lib.sh')
| -rw-r--r-- | t/test-lib.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index baa4093073..afd3053f96 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -230,6 +230,22 @@ test_decode_color () { -e 's/.\[m/<RESET>/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 |
