Skip to content

Commit

Permalink
#148 Little refactor to support a more elastic local dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
la10736 committed Jun 19, 2022
1 parent 7e1c9bb commit 94229f7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions rstest_test/src/prj.rs
Expand Up @@ -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();

Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 94229f7

Please sign in to comment.