[PATCH v2 3/5] t0041: use test_line_count_cmd to check std{out,err}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Đoàn Trần Công Danh <congdanhqx@xxxxxxxxx>
---
 t/t0041-usage.sh | 53 ++++++++++++++++--------------------------------
 1 file changed, 17 insertions(+), 36 deletions(-)

diff --git a/t/t0041-usage.sh b/t/t0041-usage.sh
index c4fc34eb18..24e24f698c 100755
--- a/t/t0041-usage.sh
+++ b/t/t0041-usage.sh
@@ -12,98 +12,79 @@ test_expect_success 'setup ' '
 '
 
 test_expect_success 'tag --contains <existent_tag>' '
-	git tag --contains "v1.0" >actual 2>actual.err &&
-	grep "v1.0" actual &&
-	test_line_count = 0 actual.err
+	test_line_count_cmd --err = 0 git tag --contains v1.0 >actual &&
+	grep "v1.0" actual
 '
 
 test_expect_success 'tag --contains <inexistent_tag>' '
-	test_must_fail git tag --contains "notag" >actual 2>actual.err &&
-	test_line_count = 0 actual &&
+	test_line_count_cmd --out = 0 test_must_fail git tag --contains notag 2>actual.err &&
 	test_i18ngrep "error" actual.err &&
 	test_i18ngrep ! "usage" actual.err
 '
 
 test_expect_success 'tag --no-contains <existent_tag>' '
-	git tag --no-contains "v1.0" >actual 2>actual.err  &&
-	test_line_count = 0 actual &&
-	test_line_count = 0 actual.err
+	test_line_count_cmd --out = 0 --err = 0 git tag --no-contains v1.0
 '
 
 test_expect_success 'tag --no-contains <inexistent_tag>' '
-	test_must_fail git tag --no-contains "notag" >actual 2>actual.err &&
-	test_line_count = 0 actual &&
+	test_line_count_cmd --out = 0 test_must_fail git tag --no-contains notag 2>actual.err &&
 	test_i18ngrep "error" actual.err &&
 	test_i18ngrep ! "usage" actual.err
 '
 
 test_expect_success 'tag usage error' '
-	test_must_fail git tag --noopt >actual 2>actual.err &&
-	test_line_count = 0 actual &&
+	test_line_count_cmd --out = 0 test_must_fail git tag --noopt 2>actual.err &&
 	test_i18ngrep "usage" actual.err
 '
 
 test_expect_success 'branch --contains <existent_commit>' '
-	git branch --contains "main" >actual 2>actual.err &&
-	test_i18ngrep "main" actual &&
-	test_line_count = 0 actual.err
+	test_line_count_cmd --err = 0 git branch --contains main >actual &&
+	test_i18ngrep "main" actual
 '
 
 test_expect_success 'branch --contains <inexistent_commit>' '
-	test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
-	test_line_count = 0 actual &&
+	test_line_count_cmd --out = 0 test_must_fail git branch --no-contains "nocommit" 2>actual.err &&
 	test_i18ngrep "error" actual.err &&
 	test_i18ngrep ! "usage" actual.err
 '
 
 test_expect_success 'branch --no-contains <existent_commit>' '
-	git branch --no-contains "main" >actual 2>actual.err &&
-	test_line_count = 0 actual &&
-	test_line_count = 0 actual.err
+	test_line_count_cmd --out = 0 --err = 0 git branch --no-contains main
 '
 
 test_expect_success 'branch --no-contains <inexistent_commit>' '
-	test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
-	test_line_count = 0 actual &&
+	test_line_count_cmd --out = 0 test_must_fail git branch --no-contains "nocommit" 2>actual.err &&
 	test_i18ngrep "error" actual.err &&
 	test_i18ngrep ! "usage" actual.err
 '
 
 test_expect_success 'branch usage error' '
-	test_must_fail git branch --noopt >actual 2>actual.err &&
-	test_line_count = 0 actual &&
+	test_line_count_cmd --out = 0 test_must_fail git branch --noopt 2>actual.err &&
 	test_i18ngrep "usage" actual.err
 '
 
 test_expect_success 'for-each-ref --contains <existent_object>' '
-	git for-each-ref --contains "main" >actual 2>actual.err &&
-	test_line_count = 2 actual &&
-	test_line_count = 0 actual.err
+	test_line_count_cmd --out = 2 --err = 0 git for-each-ref --contains main
 '
 
 test_expect_success 'for-each-ref --contains <inexistent_object>' '
-	test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
-	test_line_count = 0 actual &&
+	test_line_count_cmd --out = 0 test_must_fail git for-each-ref --no-contains "noobject" 2>actual.err &&
 	test_i18ngrep "error" actual.err &&
 	test_i18ngrep ! "usage" actual.err
 '
 
 test_expect_success 'for-each-ref --no-contains <existent_object>' '
-	git for-each-ref --no-contains "main" >actual 2>actual.err &&
-	test_line_count = 0 actual &&
-	test_line_count = 0 actual.err
+	test_line_count_cmd --out = 0 --err = 0 git for-each-ref --no-contains "main"
 '
 
 test_expect_success 'for-each-ref --no-contains <inexistent_object>' '
-	test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
-	test_line_count = 0 actual &&
+	test_line_count_cmd --out = 0 test_must_fail git for-each-ref --no-contains "noobject" 2>actual.err &&
 	test_i18ngrep "error" actual.err &&
 	test_i18ngrep ! "usage" actual.err
 '
 
 test_expect_success 'for-each-ref usage error' '
-	test_must_fail git for-each-ref --noopt >actual 2>actual.err &&
-	test_line_count = 0 actual &&
+	test_line_count_cmd --out = 0 test_must_fail git for-each-ref --noopt 2>actual.err &&
 	test_i18ngrep "usage" actual.err
 '
 
-- 
2.32.0.278.gd42b80f139




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux