Skip to contentSkip to conversation

t4012: Make --shortstat more robust

PATCH Superseded Alexander Strasser 2 participants 3 messages Jun 15, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 6/6 t4012: Make --shortstat more robust

The --shortstat test depends on the same scenario as the --stat test. Use the part of the same expected result for the --stat test to avoid duplicating it manually.

---
 t/t4012-diff-binary.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
t/t4012-diff-binary.sh +2 -2
index 81a9e8c..a3f6030 100755
@@ -38,9 +38,9 @@ test_expect_success 'apply --stat output for binary file change' '
 '
 
 test_expect_success 'diff --shortstat output for binary file change' '
-	echo " 4 files changed, 2 insertions(+), 2 deletions(-)" >expected &&
+	tail -1 expected >expect &&
 	git diff --shortstat >current &&
-	test_i18ncmp expected current
+	test_i18ncmp expect current
 '
 
 test_expect_success 'diff --shortstat output for binary file change only' '
Signature · 1 line
1.7.10.2.552.gaa3bb87
#1 lore raw
Quoted 9 lines · Alexander Strasser

The --shortstat test depends on the same scenario as the --stat test. Use the part of the same expected result for the --stat test to avoid duplicating it manually.

t/t4012-diff-binary.sh +0 -0
index 81a9e8c..a3f6030 100755

t/t4012-diff-binary.sh test_expect_success 'apply --stat output for binary file change' ' · line 41

Quoted 5 lines
t/t4012-diff-binary.sh +1 -1
@@ -38,9 +38,9 @@ test_expect_success 'apply --stat output for binary file change' '
 '
 
 test_expect_success 'diff --shortstat output for binary file change' '
-	echo " 4 files changed, 2 insertions(+), 2 deletions(-)" >expected &&
+	tail -1 expected >expect &&

"(tail|head) -n 1" is preferred. There are the same POSIX.1 violations in a handful of other scripts, 5526, 7502, 7800 and 9146.

t/t4012-diff-binary.sh test_expect_success 'apply --stat output for binary file change' ' · line 46

Quoted 6 lines
t/t4012-diff-binary.sh +1 -1
 	git diff --shortstat >current &&
-	test_i18ncmp expected current
+	test_i18ncmp expect current
 '
 
 test_expect_success 'diff --shortstat output for binary file change only' '

Other than that, the series looked good. Thanks.

#2 lore raw

Hi,

seems I managed to omit a word in the short log message:
t4012: Make --shortstat *test* more robust

Quoted 13 lines · Junio C Hamano
Quoted 11 lines · Alexander Strasser

The --shortstat test depends on the same scenario as the --stat test. Use the part of the same expected result for the --stat test to avoid duplicating it manually.

t/t4012-diff-binary.sh +0 -0
index 81a9e8c..a3f6030 100755
@@ -38,9 +38,9 @@ test_expect_success 'apply --stat output for binary file change' '
 '
 
Quoted 7 lines

t/t4012-diff-binary.sh test_expect_success 'apply --stat output for binary file change' ' · line 41

Quoted 3 lines
t/t4012-diff-binary.sh +1 -1
 test_expect_success 'diff --shortstat output for binary file change' '
-	echo " 4 files changed, 2 insertions(+), 2 deletions(-)" >expected &&
+	tail -1 expected >expect &&

"(tail|head) -n 1" is preferred. There are the same POSIX.1 violations in a handful of other scripts, 5526, 7502, 7800 and 9146.

OK, got it.

Quoted 8 lines

t/t4012-diff-binary.sh test_expect_success 'apply --stat output for binary file change' ' · line 46

Quoted 6 lines
t/t4012-diff-binary.sh +1 -1
 	git diff --shortstat >current &&
-	test_i18ncmp expected current
+	test_i18ncmp expect current
 '
 
 test_expect_success 'diff --shortstat output for binary file change only' '

Other than that, the series looked good. Thanks.

I will wait a bit longer for comments and then resend a corrected
version. Thanks for the quick reply.

Alexander