git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t9700: fix test for perl older than 5.14

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 4, 2016, 18:15 UTC
Message-ID
<xmqqwppiyuqy.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160304114321.GA569@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 10 quoted lines
> One workaround would therefore be for him to tweak PERL_PATH, but
> obviously that does not help anyone else. I think we should do this:
>
> -- >8 --
> Subject: t9700: fix test for perl older than 5.14
>
> Commit d53c2c6 (mingw: fix t9700's assumption about
> directory separators, 2016-01-27) uses perl's "/r" regex
> modifier to do a non-destructive replacement on a string,
> leaving the original unmodified and returning the result.

Will apply on js/mingw-tests and merge to 'master' before -rc1. Thanks.

Show 45 quoted lines
>
> This feature was introduced in perl 5.14, but systems with
> older perl are still common (e.g., CentOS 6.5 still has perl
> 5.10). Let's work around it by providing a helper function
> that does the same thing using older syntax.
>
> While we're at it, let's switch to using an alternate regex
> separator, which is slightly more readable.
>
> Reported-by: Christian Couder <christian.couder@gmail.com>
> Helped-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> And yes, before anyone checks, the alternate separators are available
> even in ancient versions of perl. :)
>
>  t/t9700/test.pl | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/t/t9700/test.pl b/t/t9700/test.pl
> index 7e8c40b..1b75c91 100755
> --- a/t/t9700/test.pl
> +++ b/t/t9700/test.pl
> @@ -17,6 +17,12 @@ BEGIN {
>  use Cwd;
>  use File::Basename;
>  
> +sub adjust_dirsep {
> +	my $path = shift;
> +	$path =~ s{\\}{/}g;
> +	return $path;
> +}
> +
>  BEGIN { use_ok('Git') }
>  
>  # set up
> @@ -33,7 +39,7 @@ is($r->config_int("test.int"), 2048, "config_int: integer");
>  is($r->config_int("test.nonexistent"), undef, "config_int: nonexistent");
>  ok($r->config_bool("test.booltrue"), "config_bool: true");
>  ok(!$r->config_bool("test.boolfalse"), "config_bool: false");
> -is($r->config_path("test.path") =~ s/\\/\//gr, $r->config("test.pathexpanded"),
> +is(adjust_dirsep($r->config_path("test.path")), $r->config("test.pathexpanded"),
>     "config_path: ~/foo expansion");
>  is_deeply([$r->config_path("test.pathmulti")], ["foo", "bar"],
>     "config_path: multiple values");
Previous: Johannes Schindelin
Message 10 of 10 in “t9700-perl-git.sh is broken on some configurations”
  1. Christian CouderMar 4, 2016
  2. Jeff KingMar 4, 2016
  3. Christian CouderMar 4, 2016
  4. Jeff KingMar 4, 2016
  5. Dennis KaarsemakerMar 4, 2016
  6. t9700: fix test for perl older than 5.14Jeff King, Mar 4, 2016
  7. Dennis KaarsemakerMar 4, 2016
  8. Christian CouderMar 4, 2016
  9. Johannes SchindelinMar 4, 2016
  10. Junio C HamanoMar 4, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.