Skip to content

Commit

Permalink
feat: add initialize for lock clone
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Jan 13, 2021
1 parent 3e4ab20 commit af642b3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/infrastructure/git_log_parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl GitLogParser {

let buf = GitLogParser::uri_to_path(root, uri_path);

println!("tempdir: {:?}", buf.clone());
println!("tempdir: {:?}", buf);
if buf.exists() {
// todo: make update for repo
println!("todo: make update for repo");
Expand Down Expand Up @@ -65,16 +65,28 @@ impl GitLogParser {
#[cfg(test)]
mod test {
use crate::infrastructure::git_log_parser::GitLogParser;
use std::sync::Once;

static INIT: Once = Once::new();

pub fn initialize() {
INIT.call_once(|| {
GitLogParser::clone("https://github.com/phodal/coco.fixtures");
// initialization code here
});
}

#[test]
fn should_support_clone() {
initialize();
let repo = GitLogParser::clone("https://github.com/phodal/coco.fixtures");
let result = repo.revparse("master");
assert!(result.is_ok());
}

#[test]
fn should_verify_github_dir() {
initialize();
let repo = GitLogParser::clone("https://github.com/phodal/coco.fixtures");
let path_str = repo.path().to_str().unwrap();
assert!(path_str.contains("github.com/phodal/coco.fixtures"));
Expand Down

0 comments on commit af642b3

Please sign in to comment.