diff --git a/rstest_test/src/prj.rs b/rstest_test/src/prj.rs index 9ba29e9..a36de9f 100644 --- a/rstest_test/src/prj.rs +++ b/rstest_test/src/prj.rs @@ -186,10 +186,19 @@ impl Project { pub fn add_local_dependency(&self, name: &str) { self.add_dependency( name, - format!(r#"{{path="{}"}}"#, self.current_dir_str()).as_str(), + format!(r#"{{path="{}"}}"#, self.exec_dir_str()).as_str(), ); } + pub fn exec_dir_str(&self) -> String { + std::env::current_dir() + .unwrap() + .as_os_str() + .to_str() + .unwrap() + .to_owned() + } + fn workspace_add(&self, prj: &str) { let mut doc = self.read_cargo_toml(); @@ -230,15 +239,6 @@ impl Project { .expect("cannot write Cargo.toml"); } - fn current_dir_str(&self) -> String { - std::env::current_dir() - .unwrap() - .as_os_str() - .to_str() - .unwrap() - .to_owned() - } - fn cargo_channel_arg(&self) -> String { match &self.channel { Channel::Stable => "+stable".into(),