From: Eric Sunshine Date: Thu, 20 Mar 2025 19:41:11 GMT Subject: Re: [PATCH 15/20] t/lib-t6000: refactor `name_from_description()` to not depend on Perl Message-ID: In-Reply-To: <20250320-b4-pks-t-perlless-v1-15-b1eefe27ac55@pks.im> On Thu, Mar 20, 2025 at 5:37 AM Patrick Steinhardt wrote: > 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 > --- > diff --git a/t/lib-t6000.sh b/t/lib-t6000.sh > @@ -109,13 +109,12 @@ check_output () { > # All alphanums translated into -'s which are then compressed and stripped > # from front and back. > name_from_description () { > - perl -pe ' > - s/[^A-Za-z0-9.]/-/g; > - s/-+/-/g; > - s/-$//; > - s/^-//; > - y/A-Z/a-z/; > - ' > + sed \ > + -e 's/[^A-Za-z0-9.]/-/g' \ > + -e 's/--*/-/g' \ > + -e 's/-$//' \ > + -e 's/^-//' | > + tr 'A-Z' 'a-z' > } Can't you just use sed's `y//` function directly instead of having to separately invoke a `tr` command?