History

git-commitgraph uses test-tools

I plan to eventually make running the test-repo initialization more efficient as there are more and more of these, and this should easily be shared across crates.

Sebastian Thiel committed 5 years ago

Commit 5d30e5a1 parent b1176269 files · +9 −37Browse files

Showing the changes to git-commitgraph/tests/commitgraph.rs (1 of 9 files). Show all

Unified · Split

git-commitgraph/tests/commitgraph.rs+4−15
@@ -4,7 +4,7 @@ use std::{ · 3 unmodified lines
44 convert::{TryFrom, TryInto},
55 hash::BuildHasher,
66 io::{BufRead, Cursor},
7− path::{Path, PathBuf},
7+ path::Path,
88 process::Command,
99 };
1010
@@ -59,20 +59,9 @@ pub fn check_common(cg: &Graph, expected: &HashMap<String, RefInfo, impl BuildHa · 48 unmodified lines
5959 );
6060 }
6161
62−pub fn create_repo(script_path: &str) -> tempfile::TempDir {
63− let dir = tempfile::tempdir().expect("failed to create temp dir");
64− let status = Command::new("bash")
65− .arg(fixture_path(script_path))
66− .arg(dir.path())
67− .env_remove("GIT_DIR")
68− .status()
69− .expect("failed to run repo script");
70− assert!(status.success(), "repo script failed");
71− dir
72−}
73−
74−pub fn fixture_path(path: &str) -> PathBuf {
75− PathBuf::from("tests").join("fixtures").join(path)
62+use test_tools::assure_fixture_repo_present;
63+pub fn create_repo(script_path: &str) -> test_tools::tempdir::TempDir {
64+ assure_fixture_repo_present(script_path).expect("script succeeds all the time")
7665 }
7766
7867 pub fn hex_to_id(hex: &[u8]) -> git_hash::ObjectId {