test: fix Command::current_dir API
Every single call site wants to pass a path relative to the directory the command was created for. So just make it do that automatically, similar to `Dir::create` and friends.
This commit is contained in:
@@ -273,11 +273,14 @@ impl TestCommand {
|
||||
|
||||
/// Set the working directory for this command.
|
||||
///
|
||||
/// The path given is interpreted relative to the directory that this
|
||||
/// command was created for.
|
||||
///
|
||||
/// Note that this does not need to be called normally, since the creation
|
||||
/// of this TestCommand causes its working directory to be set to the
|
||||
/// test's directory automatically.
|
||||
pub fn current_dir<P: AsRef<Path>>(&mut self, dir: P) -> &mut TestCommand {
|
||||
self.cmd.current_dir(dir);
|
||||
self.cmd.current_dir(self.dir.path().join(dir));
|
||||
self
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user