test_cmp expect actual
'
-iconv -f utf-8 -t $test_encoding > commit-msg <<EOF
-Test printing of complex bodies
+test_expect_success 'setup complex body' '
+ message=$(cat <<-EOF
+ Test printing of complex bodies
-This commit message is much longer than the others,
-and it will be encoded in $test_encoding. We should therefore
-include an ISO8859 character: ¡bueno!
-EOF
+ This commit message is much longer than the others,
+ and it will be encoded in $test_encoding. We should therefore
+ include an ISO8859 character: ¡bueno!
+ EOF
+ ) &&
+
+ if test_have_prereq ICONV
+ then
+ echo "$message" | iconv -f utf-8 -t $test_encoding >commit-msg
+ else
+ echo "$message" >commit-msg
+ fi &&
-test_expect_success 'setup complex body' '
git config i18n.commitencoding $test_encoding &&
echo change2 >foo && git commit -a -F commit-msg &&
head3=$(git rev-parse --verify HEAD) &&
commit $head2
commit $head1
EOF
- iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
+ if test_have_prereq ICONV
+ then
+ iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
+ else
+ cp expected.utf-8 expected.ISO8859-1
+ fi
'
test_format complex-body %b <expected.ISO8859-1