From: Stefano Lattarini Date: Wed, 11 Apr 2012 11:24:01 +0000 (+0200) Subject: tests: modernise style: more uses of test_line_count X-Git-Tag: v1.7.10.2~8^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3fb0459bc89bebb07e0603ce3ce92dbbc8a39ea4;p=git.git tests: modernise style: more uses of test_line_count Prefer: test_line_count COUNT FILE over: test $(wc -l COUNT (or similar usages) in several tests. Signed-off-by: Stefano Lattarini Signed-off-by: Junio C Hamano --- diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 252fc8283..236b13a3a 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -100,8 +100,7 @@ test_expect_success setup ' check_fsck && - loglen=$(wc -l <.git/logs/refs/heads/master) && - test $loglen = 4 + test_line_count = 4 .git/logs/refs/heads/master ' test_expect_success rewind ' @@ -117,8 +116,7 @@ test_expect_success rewind ' check_have A B C D E F G H I J K L && - loglen=$(wc -l <.git/logs/refs/heads/master) && - test $loglen = 5 + test_line_count = 5 .git/logs/refs/heads/master ' test_expect_success 'corrupt and check' ' @@ -136,8 +134,7 @@ test_expect_success 'reflog expire --dry-run should not touch reflog' ' --stale-fix \ --all && - loglen=$(wc -l <.git/logs/refs/heads/master) && - test $loglen = 5 && + test_line_count = 5 .git/logs/refs/heads/master && check_fsck "missing blob $F" ' @@ -150,8 +147,7 @@ test_expect_success 'reflog expire' ' --stale-fix \ --all && - loglen=$(wc -l <.git/logs/refs/heads/master) && - test $loglen = 2 && + test_line_count = 2 .git/logs/refs/heads/master && check_fsck "dangling commit $K" ' @@ -217,9 +213,7 @@ test_expect_success 'delete' ' test_expect_success 'rewind2' ' test_tick && git reset --hard HEAD~2 && - loglen=$(wc -l <.git/logs/refs/heads/master) && - test $loglen = 4 - + test_line_count = 4 .git/logs/refs/heads/master ' test_expect_success '--expire=never' ' @@ -228,9 +222,7 @@ test_expect_success '--expire=never' ' --expire=never \ --expire-unreachable=never \ --all && - loglen=$(wc -l <.git/logs/refs/heads/master) && - test $loglen = 4 - + test_line_count = 4 .git/logs/refs/heads/master ' test_expect_success 'gc.reflogexpire=never' ' @@ -238,8 +230,7 @@ test_expect_success 'gc.reflogexpire=never' ' git config gc.reflogexpire never && git config gc.reflogexpireunreachable never && git reflog expire --verbose --all && - loglen=$(wc -l <.git/logs/refs/heads/master) && - test $loglen = 4 + test_line_count = 4 .git/logs/refs/heads/master ' test_expect_success 'gc.reflogexpire=false' ' @@ -247,8 +238,7 @@ test_expect_success 'gc.reflogexpire=false' ' git config gc.reflogexpire false && git config gc.reflogexpireunreachable false && git reflog expire --verbose --all && - loglen=$(wc -l <.git/logs/refs/heads/master) && - test $loglen = 4 && + test_line_count = 4 .git/logs/refs/heads/master && git config --unset gc.reflogexpire && git config --unset gc.reflogexpireunreachable diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh index 36cca14d9..0f4b2896a 100755 --- a/t/t2004-checkout-cache-temp.sh +++ b/t/t2004-checkout-cache-temp.sh @@ -40,7 +40,7 @@ test_expect_success \ rm -f path* .merge_* out .git/index && git read-tree $t1 && git checkout-index --temp -- path1 >out && -test $(wc -l out && -test $(wc -l out && -test $(wc -l out && -test $(wc -l out && -test $(wc -l out && -test $(wc -l out && -test $(wc -l out && -test $(wc -l out && - test $(wc -l out && -test $(wc -l actual && - test $(wc -l actual && - test 3 = $(wc -l actual && - test 3 = $(wc -l actual && - test 4 = $(wc -l actual && - test 4 = $(wc -l actual && - test 5 = $(wc -l actual && - test 3 = $(wc -l actual && - test 3 = $(wc -l actual && - test 3 = $(wc -l actual && - test 3 = $(wc -l cnt - test $? = 1 && test $(wc -l cnt - test $? = 0 && test $(wc -l cnt - test $? = 1 && test $(wc -l cnt - test $? = 1 && test $(wc -l cnt - test $? = 0 && test $(wc -l cnt - test $? = 0 && test $(wc -l cnt - test $? = 0 && test $(wc -l cnt - test $? = 1 && test $(wc -l >b && echo 3 >c && git add . && { git diff-index --quiet --cached HEAD^ >cnt - test $? = 1 && test $(wc -l cnt - test $? = 1 && test $(wc -l cnt - test $? = 0 && test $(wc -l >c && { git diff-files --quiet >cnt - test $? = 1 && test $(wc -l cnt - test $? = 1 && test $(wc -l fsck.log && - test `wc -l < fsck.log` = 0 + test_line_count = 0 fsck.log } base_dir=`pwd` diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index 444279077..a01d24450 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -188,23 +188,23 @@ test_expect_success 'empty email' ' test_expect_success 'del LF before empty (1)' ' git show -s --pretty=format:"%s%n%-b%nThanks%n" HEAD^^ >actual && - test $(wc -l actual && - test $(wc -l actual && - test $(wc -l actual && - test $(wc -l test.txt && - test $(git rev-list --oneline HEAD | wc -l) -eq 5 && - test $(git rev-list --oneline --graph HEAD | wc -l) -eq 5 + test_line_count = 5 test.txt && + git rev-list --oneline --graph HEAD >testg.txt && + test_line_count = 5 testg.txt ' test_done diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 691e4a448..72e28ee53 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -480,7 +480,7 @@ test_expect_success 'many merge bases creation' ' git merge -m "merge HASH7 and SIDE_HASH7" "$HASH7" && B_HASH=$(git rev-parse --verify HEAD) && git merge-base --all "$A_HASH" "$B_HASH" > merge_bases.txt && - test $(wc -l < merge_bases.txt) = "2" && + test_line_count = 2 merge_bases.txt && grep "$HASH5" merge_bases.txt && grep "$SIDE_HASH5" merge_bases.txt ' diff --git a/t/t6032-merge-large-rename.sh b/t/t6032-merge-large-rename.sh index 94f010be8..15beecc3c 100755 --- a/t/t6032-merge-large-rename.sh +++ b/t/t6032-merge-large-rename.sh @@ -97,7 +97,7 @@ test_expect_success 'setup large simple rename' ' test_expect_success 'massive simple rename does not spam added files' ' sane_unset GIT_MERGE_VERBOSITY && git merge --no-stat simple-rename | grep -v Removing >output && - test 5 -gt "$(wc -l < output)" + test_line_count -lt 5 output ' test_done diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh index 32591f941..466fa3804 100755 --- a/t/t6042-merge-rename-corner-cases.sh +++ b/t/t6042-merge-rename-corner-cases.sh @@ -104,7 +104,7 @@ test_expect_failure 'conflict caused if rename not detected' ' test 0 -eq $(git ls-files -u | wc -l) && test 0 -eq $(git ls-files -o | wc -l) && - test 6 -eq $(wc -l < c) && + test_line_count = 6 c && test $(git rev-parse HEAD:a) = $(git rev-parse B:a) && test $(git rev-parse HEAD:b) = $(git rev-parse A:b) ' diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 07fb53adc..be9672e5a 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -229,7 +229,7 @@ test_expect_success 'checkout to detach HEAD (with advice declined)' ' git checkout -f renamer && git clean -f && git checkout renamer^ 2>messages && test_i18ngrep "HEAD is now at 7329388" messages && - test 1 -eq $(wc -l messages && test_i18ngrep "HEAD is now at 7329388" messages && - test 1 -lt $(wc -l lines && - test $(wc -l actual && - test $(wc -l ../out && - test $(wc -l <../out) = 2 + test_line_count = 2 ../out ' cd "$WORKDIR" test_expect_success 'cvs status (nonrecursive)' ' cd cvswork && GIT_CONFIG="$git_config" cvs status -l | grep "^File: status.file" >../out && - test $(wc -l <../out) = 1 + test_line_count = 1 ../out ' cd "$WORKDIR"