git/contrib/mw-to-git/t/t9365-continuing-queries.sh
Eric Sunshine 0c51d6b4ae t6000-t9999: detect and signal failure within loop
Failures within `for` and `while` loops can go unnoticed if not detected
and signaled manually since the loop itself does not abort when a
contained command fails, nor will a failure necessarily be detected when
the loop finishes since the loop returns the exit code of the last
command it ran on the final iteration, which may not be the command
which failed. Therefore, detect and signal failures manually within
loops using the idiom `|| return 1` (or `|| exit 1` within subshells).

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-13 10:29:48 -08:00

24 lines
485 B
Bash
Executable file

#!/bin/sh
test_description='Test the Git Mediawiki remote helper: queries w/ more than 500 results'
. ./test-gitmw-lib.sh
. $TEST_DIRECTORY/test-lib.sh
test_check_precond
test_expect_success 'creating page w/ >500 revisions' '
wiki_reset &&
for i in $(test_seq 501)
do
echo "creating revision $i" &&
wiki_editpage foo "revision $i<br/>" true || return 1
done
'
test_expect_success 'cloning page w/ >500 revisions' '
git clone mediawiki::'"$WIKI_URL"' mw_dir
'
test_done