3 test_description
='log/show --expand-tabs'
5 TEST_PASSES_SANITIZE_LEAK
=true
9 title
='tab indent at the beginning of the title line'
10 body
='tab indent on a line in the body'
12 # usage: count_expand $indent $numSP $numHT @format_args
16 count
=$
(( $1 + $2 )) ;# expected spaces
17 while test $count -gt 0
20 count
=$
(( $count - 1 ))
23 count
=$1 ;# expected tabs
24 while test $count -gt 0
27 count
=$
(( $count - 1 ))
31 # The remainder of the command line is "git show -s" options
39 # Prefix the output with the command line arguments, and
40 # replace SP with a dot both in the expected and actual output
41 # so that test_cmp would show the difference together with the
42 # breakage in a way easier to consume by the debugging user.
46 } |
sed -e 's/ /./g' >expect
51 sed -n -e "/$line\$/p"
52 } |
sed -e 's/ /./g' >actual
54 test_cmp expect actual
61 *=raw |
*=short |
*=email
)
72 test_expect_success
"expand/no-expand${fmt:+ for $fmt}" '
73 count_expand $in $default $fmt &&
74 count_expand $in 8 0 $fmt --expand-tabs &&
75 count_expand $in 8 0 --expand-tabs $fmt &&
76 count_expand $in 8 0 $fmt --expand-tabs=8 &&
77 count_expand $in 8 0 --expand-tabs=8 $fmt &&
78 count_expand $in 0 1 $fmt --no-expand-tabs &&
79 count_expand $in 0 1 --no-expand-tabs $fmt &&
80 count_expand $in 0 1 $fmt --expand-tabs=0 &&
81 count_expand $in 0 1 --expand-tabs=0 $fmt &&
82 count_expand $in 4 0 $fmt --expand-tabs=4 &&
83 count_expand $in 4 0 --expand-tabs=4 $fmt
87 test_expect_success
'setup' '
89 sed -e "s/Q/$HT/g" <<-EOF >msg &&
94 git commit --allow-empty -F msg
99 test_expand
--pretty=short
100 test_expand
--pretty=medium
101 test_expand
--pretty=full
102 test_expand
--pretty=fuller
103 test_expand
--pretty=raw
104 test_expand
--pretty=email