[PATCH 2/2] test: relocate yes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a command meant to be called by the subshells: therefore it
belongs in test-lib-functions.sh.

Cc: Brandon Casey <drafnel@xxxxxxxxx>
Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 t/test-lib-functions.sh | 21 +++++++++++++++++++++
 t/test-lib.sh           | 21 ---------------------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 49a850989a..da39d98391 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -87,6 +87,27 @@ test_decode_color () {
 	'
 }
 
+# Provide an implementation of the 'yes' utility; the upper bound
+# limit is there to help Windows that cannot stop this loop from
+# wasting cycles when the downstream stops reading, so do not be
+# tempted to turn it into an infinite loop. cf. 6129c930 ("test-lib:
+# limit the output of the yes utility", 2016-02-02)
+yes () {
+	if test $# = 0
+	then
+		y=y
+	else
+		y="$*"
+	fi
+
+	i=0
+	while test $i -lt 99
+	do
+		echo "$y"
+		i=$(($i+1))
+	done
+}
+
 lf_to_nul () {
 	perl -pe 'y/\012/\000/'
 }
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 388075a6c6..24aedc122d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1694,27 +1694,6 @@ OIDPATH_REGEX=$(test_oid_to_path $ZERO_OID | sed -e 's/0/[0-9a-f]/g')
 EMPTY_TREE=$(test_oid empty_tree)
 EMPTY_BLOB=$(test_oid empty_blob)
 
-# Provide an implementation of the 'yes' utility; the upper bound
-# limit is there to help Windows that cannot stop this loop from
-# wasting cycles when the downstream stops reading, so do not be
-# tempted to turn it into an infinite loop. cf. 6129c930 ("test-lib:
-# limit the output of the yes utility", 2016-02-02)
-yes () {
-	if test $# = 0
-	then
-		y=y
-	else
-		y="$*"
-	fi
-
-	i=0
-	while test $i -lt 99
-	do
-		echo "$y"
-		i=$(($i+1))
-	done
-}
-
 # The GIT_TEST_FAIL_PREREQS code hooks into test_set_prereq(), and
 # thus needs to be set up really early, and set an internal variable
 # for convenience so the hot test_set_prereq() codepath doesn't need
-- 
2.39.2.13.g1fb56cf030




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux