Compare commits
3 Commits
efc28c3bd0
...
a6b254ca2d
Author | SHA1 | Date |
---|---|---|
Jean-Claude | a6b254ca2d | |
Jean-Claude | 255f1df055 | |
Jean-Claude | 5f8ccf0ab0 |
|
@ -10,7 +10,14 @@ use testdir::testdir;
|
|||
#[fixture]
|
||||
/// Return path to a temporary test directory
|
||||
pub fn tmp_dir() -> PathBuf {
|
||||
testdir!()
|
||||
let mut path = testdir!();
|
||||
path.push(format!(
|
||||
"dir_{}",
|
||||
Alphanumeric.sample_string(&mut thread_rng(), 8)
|
||||
));
|
||||
fs::create_dir_all(&path)
|
||||
.unwrap_or_else(|_| panic!("Failed to create tmpdir {}", path.display()));
|
||||
path
|
||||
}
|
||||
|
||||
#[fixture]
|
||||
|
|
13
src/git.rs
13
src/git.rs
|
@ -155,21 +155,21 @@ mod tests {
|
|||
.arg("branch")
|
||||
.arg("branch1")
|
||||
.arg("main")
|
||||
.current_dir(repo)
|
||||
.current_dir(&repo)
|
||||
.output()
|
||||
.expect("Failed to run command");
|
||||
Command::new("git")
|
||||
.arg("branch")
|
||||
.arg("branch2")
|
||||
.arg("main")
|
||||
.current_dir(repo)
|
||||
.current_dir(&repo)
|
||||
.output()
|
||||
.expect("Failed to run command");
|
||||
Command::new("git")
|
||||
.arg("branch")
|
||||
.arg("branch3")
|
||||
.arg("main")
|
||||
.current_dir(repo)
|
||||
.current_dir(&repo)
|
||||
.output()
|
||||
.expect("Failed to run command");
|
||||
}
|
||||
|
@ -179,7 +179,6 @@ mod tests {
|
|||
///
|
||||
/// Changes working directory into the repo's root.
|
||||
fn repository(tmp_dir: PathBuf) -> (Repository, PathBuf) {
|
||||
set_current_dir(&tmp_dir).expect("Failed to change dir");
|
||||
let repo = Repository::init(&tmp_dir).unwrap();
|
||||
|
||||
let _ = Command::new("git")
|
||||
|
@ -187,6 +186,8 @@ mod tests {
|
|||
.arg("--allow-empty")
|
||||
.arg("--message")
|
||||
.arg("INITIAL COMMIT")
|
||||
.arg("--no-signoff")
|
||||
.arg("--no-gpg-sign")
|
||||
.current_dir(&tmp_dir)
|
||||
.output()
|
||||
.expect("Failed to run command");
|
||||
|
@ -324,6 +325,8 @@ mod tests {
|
|||
.arg("commit")
|
||||
.arg("--message")
|
||||
.arg("Add FILE1")
|
||||
.arg("--no-signoff")
|
||||
.arg("--no-gpg-sign")
|
||||
.current_dir(&repository.1)
|
||||
.output()
|
||||
.unwrap();
|
||||
|
@ -347,6 +350,8 @@ mod tests {
|
|||
.arg("commit")
|
||||
.arg("--message")
|
||||
.arg("Update FILE1")
|
||||
.arg("--no-signoff")
|
||||
.arg("--no-gpg-sign")
|
||||
.current_dir(&repository.1)
|
||||
.output()
|
||||
.unwrap();
|
||||
|
|
Loading…
Reference in New Issue