double quoting needed in passed expression to grep

This commit is contained in:
Dirk
2026-09-01 16:19:52 +02:00
parent 6b1de564d8
commit bd67671fad
+3 -3
View File
@@ -28,7 +28,7 @@ $tests++;
#2 #2
printf "\n%s\n", "Testing for backticks ..."; printf "\n%s\n", "Testing for backticks ...";
my @matches = qx(grep -nP '`[^`]*`' $prg); @matches = qx(grep -nP '`[^`]*`' $prg);
is(scalar(@matches), 0, "Checking bad backtick patterns") is(scalar(@matches), 0, "Checking bad backtick patterns")
or diag(@matches); or diag(@matches);
$tests++; $tests++;
@@ -36,7 +36,7 @@ $tests++;
#3 #3
printf "\n%s\n", "Sourcing without checking the file exists #1 ..."; printf "\n%s\n", "Sourcing without checking the file exists #1 ...";
my @matches = qx(grep -nP '^\s*\.\s+\$' $prg); @matches = qx(grep -nP '^\\s*\\.\\s+\\$' $prg);
is(scalar(@matches), 0, "Checking bad sourcing pattern #1") is(scalar(@matches), 0, "Checking bad sourcing pattern #1")
or diag(@matches); or diag(@matches);
$tests++; $tests++;
@@ -44,7 +44,7 @@ $tests++;
#4 #4
printf "\n%s\n", "Sourcing without checking the file exists #2 ..."; printf "\n%s\n", "Sourcing without checking the file exists #2 ...";
my @matches = qx(grep -nP '^\s*source\s+\$' $prg); @matches = qx(grep -nP '^\\s*source\\s+\\$' $prg);
is(scalar(@matches), 0, "Checking bad sourcing pattern #2") is(scalar(@matches), 0, "Checking bad sourcing pattern #2")
or diag(@matches); or diag(@matches);
$tests++; $tests++;