summaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-08-24 12:34:19 -0700
committerJunio C Hamano <gitster@pobox.com>2012-08-24 12:34:19 -0700
commit871e293c9acbeaacce59dcd98fab6028f552f5be (patch)
treec363ffb2dcced8d6e8057e31c5d7378508205c50 /t/test-lib-functions.sh
parentfab4b04e4be5ccfdf93e21e7260040bd9e7faedd (diff)
parentb52183179bb0a97ea4d91d1248aca303d8e8f892 (diff)
downloadgit-871e293c9acbeaacce59dcd98fab6028f552f5be.tar.gz
Merge branch 'maint-1.7.11' into maint
* maint-1.7.11: Prepare for 1.7.11.6 Make the ciabot scripts completely self-configuring in the normal case. Improved documentation for the ciabot scripts. man: git pull -r is a short for --rebase gitcli: describe abbreviation of long options rev-list docs: clarify --topo-order description Documentation/CodingGuidelines: spell out more shell guidelines Documentation: do not mention .git/refs/* directories tests: Introduce test_seq
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 80daaca780..9096398b18 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -530,6 +530,27 @@ test_cmp() {
$GIT_TEST_CMP "$@"
}
+# Print a sequence of numbers or letters in increasing order. This is
+# similar to GNU seq(1), but the latter might not be available
+# everywhere (and does not do letters). It may be used like:
+#
+# for i in `test_seq 100`; do
+# for j in `test_seq 10 20`; do
+# for k in `test_seq a z`; do
+# echo $i-$j-$k
+# done
+# done
+# done
+
+test_seq () {
+ case $# in
+ 1) set 1 "$@" ;;
+ 2) ;;
+ *) error "bug in the test script: not 1 or 2 parameters to test_seq" ;;
+ esac
+ "$PERL_PATH" -le 'print for $ARGV[0]..$ARGV[1]' -- "$@"
+}
+
# This function can be used to schedule some commands to be run
# unconditionally at the end of the test to restore sanity:
#