Skip to content

Commit 6de6aba

Browse files
committed
Merge branch 'jc/test-seq' into maint
Test fix. * jc/test-seq: test-lib-functions.sh: rewrite test_seq without Perl test-lib-functions.sh: remove misleading comment on test_seq
2 parents 86a1d14 + 4df4313 commit 6de6aba

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

t/test-lib-functions.sh

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -718,28 +718,26 @@ test_cmp_rev () {
718718
test_cmp expect.rev actual.rev
719719
}
720720

721-
# Print a sequence of numbers or letters in increasing order. This is
722-
# similar to GNU seq(1), but the latter might not be available
723-
# everywhere (and does not do letters). It may be used like:
724-
#
725-
# for i in $(test_seq 100)
726-
# do
727-
# for j in $(test_seq 10 20)
728-
# do
729-
# for k in $(test_seq a z)
730-
# do
731-
# echo $i-$j-$k
732-
# done
733-
# done
734-
# done
721+
# Print a sequence of integers in increasing order, either with
722+
# two arguments (start and end):
723+
#
724+
# test_seq 1 5 -- outputs 1 2 3 4 5 one line at a time
725+
#
726+
# or with one argument (end), in which case it starts counting
727+
# from 1.
735728

736729
test_seq () {
737730
case $# in
738731
1) set 1 "$@" ;;
739732
2) ;;
740733
*) error "bug in the test script: not 1 or 2 parameters to test_seq" ;;
741734
esac
742-
perl -le 'print for $ARGV[0]..$ARGV[1]' -- "$@"
735+
test_seq_counter__=$1
736+
while test "$test_seq_counter__" -le "$2"
737+
do
738+
echo "$test_seq_counter__"
739+
test_seq_counter__=$(( $test_seq_counter__ + 1 ))
740+
done
743741
}
744742

745743
# This function can be used to schedule some commands to be run

0 commit comments

Comments
 (0)