Merge branch 'jk/t4205-cleanup' into maint

Test modernization.

* jk/t4205-cleanup:
  t4205: indent here documents
  t4205: drop top-level &&-chaining
This commit is contained in:
Junio C Hamano 2016-08-10 11:55:32 -07:00
commit 66d6511c53

View File

@ -145,199 +145,199 @@ test_expect_success 'setup more commits' '
test_expect_success 'left alignment formatting' ' test_expect_success 'left alignment formatting' '
git log --pretty="tformat:%<(40)%s" >actual && git log --pretty="tformat:%<(40)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-EOF >expected &&
message two Z message two Z
message one Z message one Z
add bar Z add bar Z
$(commit_msg) Z $(commit_msg) Z
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting. i18n.logOutputEncoding' ' test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(40)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(40)%s" >actual &&
qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
message two Z message two Z
message one Z message one Z
add bar Z add bar Z
$(commit_msg) Z $(commit_msg) Z
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting at the nth column' ' test_expect_success 'left alignment formatting at the nth column' '
git log --pretty="tformat:%h %<|(40)%s" >actual && git log --pretty="tformat:%h %<|(40)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-EOF >expected &&
$head1 message two Z $head1 message two Z
$head2 message one Z $head2 message one Z
$head3 add bar Z $head3 add bar Z
$head4 $(commit_msg) Z $head4 $(commit_msg) Z
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting at the nth column' ' test_expect_success 'left alignment formatting at the nth column' '
COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual && COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-EOF >expected &&
$head1 message two Z $head1 message two Z
$head2 message one Z $head2 message one Z
$head3 add bar Z $head3 add bar Z
$head4 $(commit_msg) Z $head4 $(commit_msg) Z
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' ' test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %<|(40)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %<|(40)%s" >actual &&
qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
$head1 message two Z $head1 message two Z
$head2 message one Z $head2 message one Z
$head3 add bar Z $head3 add bar Z
$head4 $(commit_msg) Z $head4 $(commit_msg) Z
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting with no padding' ' test_expect_success 'left alignment formatting with no padding' '
git log --pretty="tformat:%<(1)%s" >actual && git log --pretty="tformat:%<(1)%s" >actual &&
cat <<EOF >expected && cat <<-EOF >expected &&
message two message two
message one message one
add bar add bar
$(commit_msg) $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' ' test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(1)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(1)%s" >actual &&
cat <<EOF | iconv -f utf-8 -t $test_encoding >expected && cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
message two message two
message one message one
add bar add bar
$(commit_msg) $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting with trunc' ' test_expect_success 'left alignment formatting with trunc' '
git log --pretty="tformat:%<(10,trunc)%s" >actual && git log --pretty="tformat:%<(10,trunc)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-\EOF >expected &&
message .. message ..
message .. message ..
add bar Z add bar Z
initial... initial...
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' ' test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s" >actual &&
qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
message .. message ..
message .. message ..
add bar Z add bar Z
initial... initial...
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting with ltrunc' ' test_expect_success 'left alignment formatting with ltrunc' '
git log --pretty="tformat:%<(10,ltrunc)%s" >actual && git log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-EOF >expected &&
..sage two ..sage two
..sage one ..sage one
add bar Z add bar Z
..${sample_utf8_part}lich ..${sample_utf8_part}lich
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' ' test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,ltrunc)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
..sage two ..sage two
..sage one ..sage one
add bar Z add bar Z
..${sample_utf8_part}lich ..${sample_utf8_part}lich
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting with mtrunc' ' test_expect_success 'left alignment formatting with mtrunc' '
git log --pretty="tformat:%<(10,mtrunc)%s" >actual && git log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-\EOF >expected &&
mess.. two mess.. two
mess.. one mess.. one
add bar Z add bar Z
init..lich init..lich
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' ' test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,mtrunc)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
mess.. two mess.. two
mess.. one mess.. one
add bar Z add bar Z
init..lich init..lich
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'right alignment formatting' ' test_expect_success 'right alignment formatting' '
git log --pretty="tformat:%>(40)%s" >actual && git log --pretty="tformat:%>(40)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-EOF >expected &&
Z message two Z message two
Z message one Z message one
Z add bar Z add bar
Z $(commit_msg) Z $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'right alignment formatting. i18n.logOutputEncoding' ' test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(40)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(40)%s" >actual &&
qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
Z message two Z message two
Z message one Z message one
Z add bar Z add bar
Z $(commit_msg) Z $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'right alignment formatting at the nth column' ' test_expect_success 'right alignment formatting at the nth column' '
git log --pretty="tformat:%h %>|(40)%s" >actual && git log --pretty="tformat:%h %>|(40)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-EOF >expected &&
$head1 message two $head1 message two
$head2 message one $head2 message one
$head3 add bar $head3 add bar
$head4 $(commit_msg) $head4 $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'right alignment formatting at the nth column' ' test_expect_success 'right alignment formatting at the nth column' '
COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual && COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-EOF >expected &&
$head1 message two $head1 message two
$head2 message one $head2 message one
$head3 add bar $head3 add bar
$head4 $(commit_msg) $head4 $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' ' test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %>|(40)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %>|(40)%s" >actual &&
qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
$head1 message two $head1 message two
$head2 message one $head2 message one
$head3 add bar $head3 add bar
$head4 $(commit_msg) $head4 $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
@ -345,110 +345,110 @@ EOF
# as in previous test. # as in previous test.
test_expect_success 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' ' test_expect_success 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --graph --pretty="tformat:%h %>|(40)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --graph --pretty="tformat:%h %>|(40)%s" >actual &&
iconv -f utf-8 -t $test_encoding >expected <<EOF&& iconv -f utf-8 -t $test_encoding >expected <<-EOF &&
* $head1 message two * $head1 message two
* $head2 message one * $head2 message one
* $head3 add bar * $head3 add bar
* $head4 $(commit_msg) * $head4 $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'right alignment formatting with no padding' ' test_expect_success 'right alignment formatting with no padding' '
git log --pretty="tformat:%>(1)%s" >actual && git log --pretty="tformat:%>(1)%s" >actual &&
cat <<EOF >expected && cat <<-EOF >expected &&
message two message two
message one message one
add bar add bar
$(commit_msg) $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'right alignment formatting with no padding and with --graph' ' test_expect_success 'right alignment formatting with no padding and with --graph' '
git log --graph --pretty="tformat:%>(1)%s" >actual && git log --graph --pretty="tformat:%>(1)%s" >actual &&
cat <<EOF >expected && cat <<-EOF >expected &&
* message two * message two
* message one * message one
* add bar * add bar
* $(commit_msg) * $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' ' test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(1)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(1)%s" >actual &&
cat <<EOF | iconv -f utf-8 -t $test_encoding >expected && cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
message two message two
message one message one
add bar add bar
$(commit_msg) $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'center alignment formatting' ' test_expect_success 'center alignment formatting' '
git log --pretty="tformat:%><(40)%s" >actual && git log --pretty="tformat:%><(40)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-EOF >expected &&
Z message two Z Z message two Z
Z message one Z Z message one Z
Z add bar Z Z add bar Z
Z $(commit_msg) Z Z $(commit_msg) Z
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'center alignment formatting. i18n.logOutputEncoding' ' test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(40)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(40)%s" >actual &&
qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
Z message two Z Z message two Z
Z message one Z Z message one Z
Z add bar Z Z add bar Z
Z $(commit_msg) Z Z $(commit_msg) Z
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'center alignment formatting at the nth column' ' test_expect_success 'center alignment formatting at the nth column' '
git log --pretty="tformat:%h %><|(40)%s" >actual && git log --pretty="tformat:%h %><|(40)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-EOF >expected &&
$head1 message two Z $head1 message two Z
$head2 message one Z $head2 message one Z
$head3 add bar Z $head3 add bar Z
$head4 $(commit_msg) Z $head4 $(commit_msg) Z
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'center alignment formatting at the nth column' ' test_expect_success 'center alignment formatting at the nth column' '
COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual && COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual &&
qz_to_tab_space <<EOF >expected && qz_to_tab_space <<-EOF >expected &&
$head1 message two Z $head1 message two Z
$head2 message one Z $head2 message one Z
$head3 add bar Z $head3 add bar Z
$head4 $(commit_msg) Z $head4 $(commit_msg) Z
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' ' test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %><|(40)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %><|(40)%s" >actual &&
qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
$head1 message two Z $head1 message two Z
$head2 message one Z $head2 message one Z
$head3 add bar Z $head3 add bar Z
$head4 $(commit_msg) Z $head4 $(commit_msg) Z
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'center alignment formatting with no padding' ' test_expect_success 'center alignment formatting with no padding' '
git log --pretty="tformat:%><(1)%s" >actual && git log --pretty="tformat:%><(1)%s" >actual &&
cat <<EOF >expected && cat <<-EOF >expected &&
message two message two
message one message one
add bar add bar
$(commit_msg) $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
@ -457,34 +457,34 @@ EOF
old_head1=$(git rev-parse --verify HEAD~0) old_head1=$(git rev-parse --verify HEAD~0)
test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' ' test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(1)%s" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(1)%s" >actual &&
cat <<EOF | iconv -f utf-8 -t $test_encoding >expected && cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
message two message two
message one message one
add bar add bar
$(commit_msg) $(commit_msg)
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left/right alignment formatting with stealing' ' test_expect_success 'left/right alignment formatting with stealing' '
git commit --amend -m short --author "long long long <long@me.com>" && git commit --amend -m short --author "long long long <long@me.com>" &&
git log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual && git log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
cat <<EOF >expected && cat <<-\EOF >expected &&
short long long long short long long long
message .. A U Thor message .. A U Thor
add bar A U Thor add bar A U Thor
initial... A U Thor initial... A U Thor
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' ' test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual && git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
cat <<EOF | iconv -f utf-8 -t $test_encoding >expected && cat <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
short long long long short long long long
message .. A U Thor message .. A U Thor
add bar A U Thor add bar A U Thor
initial... A U Thor initial... A U Thor
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
@ -504,8 +504,10 @@ test_expect_success 'ISO and ISO-strict date formats display the same values' '
' '
# get new digests (with no abbreviations) # get new digests (with no abbreviations)
head1=$(git rev-parse --verify HEAD~0) && test_expect_success 'set up log decoration tests' '
head2=$(git rev-parse --verify HEAD~1) && head1=$(git rev-parse --verify HEAD~0) &&
head2=$(git rev-parse --verify HEAD~1)
'
test_expect_success 'log decoration properly follows tag chain' ' test_expect_success 'log decoration properly follows tag chain' '
git tag -a tag1 -m tag1 && git tag -a tag1 -m tag1 &&
@ -513,22 +515,22 @@ test_expect_success 'log decoration properly follows tag chain' '
git tag -d tag1 && git tag -d tag1 &&
git commit --amend -m shorter && git commit --amend -m shorter &&
git log --no-walk --tags --pretty="%H %d" --decorate=full >actual && git log --no-walk --tags --pretty="%H %d" --decorate=full >actual &&
cat <<EOF >expected && cat <<-EOF >expected &&
$head1 (tag: refs/tags/tag2) $head1 (tag: refs/tags/tag2)
$head2 (tag: refs/tags/message-one) $head2 (tag: refs/tags/message-one)
$old_head1 (tag: refs/tags/message-two) $old_head1 (tag: refs/tags/message-two)
EOF EOF
sort actual >actual1 && sort actual >actual1 &&
test_cmp expected actual1 test_cmp expected actual1
' '
test_expect_success 'clean log decoration' ' test_expect_success 'clean log decoration' '
git log --no-walk --tags --pretty="%H %D" --decorate=full >actual && git log --no-walk --tags --pretty="%H %D" --decorate=full >actual &&
cat >expected <<EOF && cat >expected <<-EOF &&
$head1 tag: refs/tags/tag2 $head1 tag: refs/tags/tag2
$head2 tag: refs/tags/message-one $head2 tag: refs/tags/message-one
$old_head1 tag: refs/tags/message-two $old_head1 tag: refs/tags/message-two
EOF EOF
sort actual >actual1 && sort actual >actual1 &&
test_cmp expected actual1 test_cmp expected actual1
' '