mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
![Ævar Arnfjörð Bjarmason](/assets/img/avatar_default.png)
Use the test_stdout_line_count helper added incdff1bb5a3
(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 indd9cede913
(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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
52 lines
1.7 KiB
Bash
Executable file
52 lines
1.7 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='git rev-list --max-count and --skip test'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'setup' '
|
|
for n in 1 2 3 4 5 ; do
|
|
echo $n > a &&
|
|
git add a &&
|
|
git commit -m "$n" || return 1
|
|
done
|
|
'
|
|
|
|
test_expect_success 'no options' '
|
|
test_stdout_line_count = 5 git rev-list HEAD
|
|
'
|
|
|
|
test_expect_success '--max-count' '
|
|
test_stdout_line_count = 0 git rev-list HEAD --max-count=0 &&
|
|
test_stdout_line_count = 3 git rev-list HEAD --max-count=3 &&
|
|
test_stdout_line_count = 5 git rev-list HEAD --max-count=5 &&
|
|
test_stdout_line_count = 5 git rev-list HEAD --max-count=10
|
|
'
|
|
|
|
test_expect_success '--max-count all forms' '
|
|
test_stdout_line_count = 1 git rev-list HEAD --max-count=1 &&
|
|
test_stdout_line_count = 1 git rev-list HEAD -1 &&
|
|
test_stdout_line_count = 1 git rev-list HEAD -n1 &&
|
|
test_stdout_line_count = 1 git rev-list HEAD -n 1
|
|
'
|
|
|
|
test_expect_success '--skip' '
|
|
test_stdout_line_count = 5 git rev-list HEAD --skip=0 &&
|
|
test_stdout_line_count = 2 git rev-list HEAD --skip=3 &&
|
|
test_stdout_line_count = 0 git rev-list HEAD --skip=5 &&
|
|
test_stdout_line_count = 0 git rev-list HEAD --skip=10
|
|
'
|
|
|
|
test_expect_success '--skip --max-count' '
|
|
test_stdout_line_count = 0 git rev-list HEAD --skip=0 --max-count=0 &&
|
|
test_stdout_line_count = 5 git rev-list HEAD --skip=0 --max-count=10 &&
|
|
test_stdout_line_count = 0 git rev-list HEAD --skip=3 --max-count=0 &&
|
|
test_stdout_line_count = 1 git rev-list HEAD --skip=3 --max-count=1 &&
|
|
test_stdout_line_count = 2 git rev-list HEAD --skip=3 --max-count=2 &&
|
|
test_stdout_line_count = 2 git rev-list HEAD --skip=3 --max-count=10 &&
|
|
test_stdout_line_count = 0 git rev-list HEAD --skip=5 --max-count=10 &&
|
|
test_stdout_line_count = 0 git rev-list HEAD --skip=10 --max-count=10
|
|
'
|
|
|
|
test_done
|