Skip to content

Commit

Permalink
Avoid assuming ./mlr is the mlr to test (#876)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
skitt authored Jan 17, 2022
1 parent 7ad53b0 commit af7bacf
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions internal/pkg/auxents/regtest/regtester.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion test/cases-not-suitable-for-ci/verb-join-prepipe/0001/cmd
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/cases-not-suitable-for-ci/verb-join-prepipe/0002/cmd
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/cases-not-suitable-for-ci/verb-join-prepipe/0003/cmd
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/cases/io-compressed-input/0001/cmd
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/cases/io-compressed-input/0002/cmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mlr --dkvp --prepipe '.${PATHSEP}mlr cat' cat test/input/abixy
mlr --dkvp --prepipe '${MLR} cat' cat test/input/abixy
2 changes: 1 addition & 1 deletion test/cases/io-compressed-input/0003/cmd
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/cases/io-compressed-input/0004/cmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mlr --dkvp --prepipe '.${PATHSEP}mlr cat' cat < test/input/abixy
mlr --dkvp --prepipe '${MLR} cat' cat < test/input/abixy

0 comments on commit af7bacf

Please sign in to comment.