t/lib-t6000: refactor name_from_description() to not depend on Perl
The `name_from_description()` test helper uses Perl to munge a given description and convert it into a name. Refactor it to instead use a combination of sed(1) and tr(1) so that we drop PERL_TEST_HELPERS prerequisites in users of this library. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
3ca6f20585
commit
de9eeabd71
@@ -109,13 +109,12 @@ check_output () {
|
|||||||
# All alphanums translated into -'s which are then compressed and stripped
|
# All alphanums translated into -'s which are then compressed and stripped
|
||||||
# from front and back.
|
# from front and back.
|
||||||
name_from_description () {
|
name_from_description () {
|
||||||
perl -pe '
|
sed \
|
||||||
s/[^A-Za-z0-9.]/-/g;
|
-e 's/[^A-Za-z0-9.]/-/g' \
|
||||||
s/-+/-/g;
|
-e 's/--*/-/g' \
|
||||||
s/-$//;
|
-e 's/-$//' \
|
||||||
s/^-//;
|
-e 's/^-//' \
|
||||||
y/A-Z/a-z/;
|
-e 'y/A-Z/a-z/'
|
||||||
'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,6 @@ test_description='Tests git rev-list --bisect functionality'
|
|||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
|
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
|
||||||
|
|
||||||
if ! test_have_prereq PERL_TEST_HELPERS
|
|
||||||
then
|
|
||||||
skip_all='skipping rev-list bisect tests; Perl not available'
|
|
||||||
test_done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# usage: test_bisection max-diff bisect-option head ^prune...
|
# usage: test_bisection max-diff bisect-option head ^prune...
|
||||||
#
|
#
|
||||||
# e.g. test_bisection 1 --bisect l1 ^l0
|
# e.g. test_bisection 1 --bisect l1 ^l0
|
||||||
|
|||||||
@@ -8,12 +8,6 @@ test_description='Tests git rev-list --topo-order functionality'
|
|||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
|
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
|
||||||
|
|
||||||
if ! test_have_prereq PERL_TEST_HELPERS
|
|
||||||
then
|
|
||||||
skip_all='skipping rev-list topo-order tests; Perl not available'
|
|
||||||
test_done
|
|
||||||
fi
|
|
||||||
|
|
||||||
list_duplicates()
|
list_duplicates()
|
||||||
{
|
{
|
||||||
"$@" | sort | uniq -d
|
"$@" | sort | uniq -d
|
||||||
|
|||||||
Reference in New Issue
Block a user