Avoid assuming ./mlr is the mlr to test (#876)

In test cases, support a ${MLR} placeholder for the mlr binary under
test, instead of assuming it's ./mlr (or its equivalent on platforms
not using forward slashes).

This ensures that wrapped mlr invocations all use the same binary,
either the default or the binary specified by the user, avoiding
surprises when ./mlr doesn't exist or is a different version.

Signed-off-by: Stephen Kitt <steve@sk2.org>
This commit is contained in:
Stephen Kitt 2022-01-17 23:01:40 +01:00 committed by GitHub
parent 7ad53b0ce1
commit af7bacf00e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 8 additions and 7 deletions

View file

@ -773,6 +773,7 @@ func (regtester *RegTester) loadFile(
contents := string(byteContents)
contents = strings.ReplaceAll(contents, "${CASEDIR}", caseDir)
contents = strings.ReplaceAll(contents, "${PATHSEP}", string(os.PathSeparator))
contents = strings.ReplaceAll(contents, "${MLR}", regtester.exeName)
return contents, nil
}

View file

@ -1 +1 @@
mlr --prepipe '.${PATHSEP}mlr cat' --odkvp join -j a -f test/input/join-het.dkvp test/input/abixy-het
mlr --prepipe '${MLR} cat' --odkvp join -j a -f test/input/join-het.dkvp test/input/abixy-het

View file

@ -1 +1 @@
mlr --odkvp join --prepipe '.${PATHSEP}mlr cat' -j a -f test/input/join-het.dkvp test/input/abixy-het
mlr --odkvp join --prepipe '${MLR} cat' -j a -f test/input/join-het.dkvp test/input/abixy-het

View file

@ -1 +1 @@
mlr --prepipe '.${PATHSEP}mlr cat' --odkvp join --prepipe cat -j a -f test/input/join-het.dkvp test/input/abixy-het
mlr --prepipe '${MLR} cat' --odkvp join --prepipe cat -j a -f test/input/join-het.dkvp test/input/abixy-het

View file

@ -1 +1 @@
mlr --csv --prepipe '.${PATHSEP}mlr --csv cat' cat test/input/rfc-csv/simple.csv-crlf
mlr --csv --prepipe '${MLR} --csv cat' cat test/input/rfc-csv/simple.csv-crlf

View file

@ -1 +1 @@
mlr --dkvp --prepipe '.${PATHSEP}mlr cat' cat test/input/abixy
mlr --dkvp --prepipe '${MLR} cat' cat test/input/abixy

View file

@ -1 +1 @@
mlr --csv --prepipe '.${PATHSEP}mlr --csv cat' cat < test/input/rfc-csv/simple.csv-crlf
mlr --csv --prepipe '${MLR} --csv cat' cat < test/input/rfc-csv/simple.csv-crlf

View file

@ -1 +1 @@
mlr --dkvp --prepipe '.${PATHSEP}mlr cat' cat < test/input/abixy
mlr --dkvp --prepipe '${MLR} cat' cat < test/input/abixy