It is not currently possible for a custom testscript command
to change the working directory of that script run.
TestScript.Exec runs the command in a subprocess,
so one cannot do ts.Exec("cd", dir).
This change adds a Chdir method to TestScript
that allows changing the working directory of the script.
The implementation is the same as the "cd" command,
which now relies on Chdir.
The availability of this function matches similar functionality in the
State.Chdir method of rsc.io/script.
(I ported some tests from rsc.io/script to testscript.)
It is not currently possible for a custom testscript command to change the working directory of that script run.
TestScript.Exec
runs the command in a subprocess, so one cannot dots.Exec("cd", dir)
.This change adds a
Chdir
method toTestScript
that allows changing the working directory of the script. The implementation is the same as the "cd" command, which now relies onChdir
.The availability of this function matches similar functionality in the
State.Chdir
method of rsc.io/script. (I ported some tests from rsc.io/script to testscript.)