Collin Funk <collin.fu...@gmail.com> writes:

> It is harmless to use it twice, but the attached patch

Forgot attachment...

>From 4d76e2641e9c1597245c30026e02c9eaa6209a9b Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sun, 19 Jan 2025 21:15:35 -0800
Subject: [PATCH] maint: tests: remove duplicate uses of 'my' in Perl

* tests/env/env-S.pl (cf): Remove uses of 'my' after the variable has
been declared.
* tests/factor/factor.pl (t): Likewise.
* tests/misc/fold.pl (prog): Remove duplicate assignment.
---
 tests/env/env-S.pl     | 6 +++---
 tests/factor/factor.pl | 2 +-
 tests/misc/fold.pl     | 1 -
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/env/env-S.pl b/tests/env/env-S.pl
index 48268b41c..2d12c1843 100755
--- a/tests/env/env-S.pl
+++ b/tests/env/env-S.pl
@@ -35,12 +35,12 @@ $env = $1;
 my $cf = '__CF_USER_TEXT_ENCODING';
 exists $ENV{$cf} and $env .= " -u$cf";
 # Likewise for these Cygwin env vars
-my $cf = 'SYSTEMROOT';
+$cf = 'SYSTEMROOT';
 exists $ENV{$cf} and $env .= " -u$cf";
-my $cf = 'WINDIR';
+$cf = 'WINDIR';
 exists $ENV{$cf} and $env .= " -u$cf";
 # Likewise for these GNU/Hurd env vars
-my $cf = 'LD_ORIGIN_PATH';
+$cf = 'LD_ORIGIN_PATH';
 exists $ENV{$cf} and $env .= " -u$cf";
 
 my @Tests =
diff --git a/tests/factor/factor.pl b/tests/factor/factor.pl
index 55397f651..c3056dc67 100755
--- a/tests/factor/factor.pl
+++ b/tests/factor/factor.pl
@@ -102,7 +102,7 @@ Test:
 foreach $t (@Tests)
   {
     (my $arg1 = $t->[1]) =~ s| *\+?||;     # strip '+'
-    (my $arg1 = $arg1) =~ s| *-[^ ]+ *||;  # strip option
+    ($arg1 = $arg1) =~ s| *-[^ ]+ *||;     # strip option
 
     # Don't fiddle with expected OUT string if there's a nonzero exit status.
     foreach my $e (@$t)
diff --git a/tests/misc/fold.pl b/tests/misc/fold.pl
index 0981ec963..877322e0a 100755
--- a/tests/misc/fold.pl
+++ b/tests/misc/fold.pl
@@ -47,6 +47,5 @@ my @Tests =
 my $save_temps = $ENV{DEBUG};
 my $verbose = $ENV{VERBOSE};
 
-my $prog = 'fold';
 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
 exit $fail;
-- 
2.48.1

Reply via email to