Skip to content

Commit a182f69

Browse files
avargitster
authored andcommitted
tests: use "test_stdout_line_count", not "test $(git [...] | wc -l)"
Use the test_stdout_line_count helper added in cdff1bb (test-lib-functions: introduce test_stdout_line_count, 2021-07-04) so that we'll spot if git itself dies, segfaults etc in these expressions. Because we didn't distinguish these failure conditions before I'd mistakenly marked these tests as passing under SANITIZE=leak in dd9cede (leak tests: mark some rev-list tests as passing with SANITIZE=leak, 2021-10-31). While we're at it let's re-indent these lines to match our usual style, as we're having to change all of them anyway. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c4d1d52 commit a182f69

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

t/t6005-rev-list-count.sh

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
test_description='git rev-list --max-count and --skip test'
44

5-
TEST_PASSES_SANITIZE_LEAK=true
65
. ./test-lib.sh
76

87
test_expect_success 'setup' '
@@ -14,39 +13,39 @@ test_expect_success 'setup' '
1413
'
1514

1615
test_expect_success 'no options' '
17-
test $(git rev-list HEAD | wc -l) = 5
16+
test_stdout_line_count = 5 git rev-list HEAD
1817
'
1918

2019
test_expect_success '--max-count' '
21-
test $(git rev-list HEAD --max-count=0 | wc -l) = 0 &&
22-
test $(git rev-list HEAD --max-count=3 | wc -l) = 3 &&
23-
test $(git rev-list HEAD --max-count=5 | wc -l) = 5 &&
24-
test $(git rev-list HEAD --max-count=10 | wc -l) = 5
20+
test_stdout_line_count = 0 git rev-list HEAD --max-count=0 &&
21+
test_stdout_line_count = 3 git rev-list HEAD --max-count=3 &&
22+
test_stdout_line_count = 5 git rev-list HEAD --max-count=5 &&
23+
test_stdout_line_count = 5 git rev-list HEAD --max-count=10
2524
'
2625

2726
test_expect_success '--max-count all forms' '
28-
test $(git rev-list HEAD --max-count=1 | wc -l) = 1 &&
29-
test $(git rev-list HEAD -1 | wc -l) = 1 &&
30-
test $(git rev-list HEAD -n1 | wc -l) = 1 &&
31-
test $(git rev-list HEAD -n 1 | wc -l) = 1
27+
test_stdout_line_count = 1 git rev-list HEAD --max-count=1 &&
28+
test_stdout_line_count = 1 git rev-list HEAD -1 &&
29+
test_stdout_line_count = 1 git rev-list HEAD -n1 &&
30+
test_stdout_line_count = 1 git rev-list HEAD -n 1
3231
'
3332

3433
test_expect_success '--skip' '
35-
test $(git rev-list HEAD --skip=0 | wc -l) = 5 &&
36-
test $(git rev-list HEAD --skip=3 | wc -l) = 2 &&
37-
test $(git rev-list HEAD --skip=5 | wc -l) = 0 &&
38-
test $(git rev-list HEAD --skip=10 | wc -l) = 0
34+
test_stdout_line_count = 5 git rev-list HEAD --skip=0 &&
35+
test_stdout_line_count = 2 git rev-list HEAD --skip=3 &&
36+
test_stdout_line_count = 0 git rev-list HEAD --skip=5 &&
37+
test_stdout_line_count = 0 git rev-list HEAD --skip=10
3938
'
4039

4140
test_expect_success '--skip --max-count' '
42-
test $(git rev-list HEAD --skip=0 --max-count=0 | wc -l) = 0 &&
43-
test $(git rev-list HEAD --skip=0 --max-count=10 | wc -l) = 5 &&
44-
test $(git rev-list HEAD --skip=3 --max-count=0 | wc -l) = 0 &&
45-
test $(git rev-list HEAD --skip=3 --max-count=1 | wc -l) = 1 &&
46-
test $(git rev-list HEAD --skip=3 --max-count=2 | wc -l) = 2 &&
47-
test $(git rev-list HEAD --skip=3 --max-count=10 | wc -l) = 2 &&
48-
test $(git rev-list HEAD --skip=5 --max-count=10 | wc -l) = 0 &&
49-
test $(git rev-list HEAD --skip=10 --max-count=10 | wc -l) = 0
41+
test_stdout_line_count = 0 git rev-list HEAD --skip=0 --max-count=0 &&
42+
test_stdout_line_count = 5 git rev-list HEAD --skip=0 --max-count=10 &&
43+
test_stdout_line_count = 0 git rev-list HEAD --skip=3 --max-count=0 &&
44+
test_stdout_line_count = 1 git rev-list HEAD --skip=3 --max-count=1 &&
45+
test_stdout_line_count = 2 git rev-list HEAD --skip=3 --max-count=2 &&
46+
test_stdout_line_count = 2 git rev-list HEAD --skip=3 --max-count=10 &&
47+
test_stdout_line_count = 0 git rev-list HEAD --skip=5 --max-count=10 &&
48+
test_stdout_line_count = 0 git rev-list HEAD --skip=10 --max-count=10
5049
'
5150

5251
test_done

0 commit comments

Comments
 (0)