Skip to content

Commit de9eeab

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3ca6f20 commit de9eeab

File tree

3 files changed

+6
-19
lines changed

3 files changed

+6
-19
lines changed

t/lib-t6000.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,12 @@ check_output () {
109109
# All alphanums translated into -'s which are then compressed and stripped
110110
# from front and back.
111111
name_from_description () {
112-
perl -pe '
113-
s/[^A-Za-z0-9.]/-/g;
114-
s/-+/-/g;
115-
s/-$//;
116-
s/^-//;
117-
y/A-Z/a-z/;
118-
'
112+
sed \
113+
-e 's/[^A-Za-z0-9.]/-/g' \
114+
-e 's/--*/-/g' \
115+
-e 's/-$//' \
116+
-e 's/^-//' \
117+
-e 'y/A-Z/a-z/'
119118
}
120119

121120

t/t6002-rev-list-bisect.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ test_description='Tests git rev-list --bisect functionality'
77
. ./test-lib.sh
88
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
99

10-
if ! test_have_prereq PERL_TEST_HELPERS
11-
then
12-
skip_all='skipping rev-list bisect tests; Perl not available'
13-
test_done
14-
fi
15-
1610
# usage: test_bisection max-diff bisect-option head ^prune...
1711
#
1812
# e.g. test_bisection 1 --bisect l1 ^l0

t/t6003-rev-list-topo-order.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ test_description='Tests git rev-list --topo-order functionality'
88
. ./test-lib.sh
99
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
1010

11-
if ! test_have_prereq PERL_TEST_HELPERS
12-
then
13-
skip_all='skipping rev-list topo-order tests; Perl not available'
14-
test_done
15-
fi
16-
1711
list_duplicates()
1812
{
1913
"$@" | sort | uniq -d

0 commit comments

Comments
 (0)