fn test_find_repo_root_from()

in focus/util/src/paths.rs [163:188]


    fn test_find_repo_root_from() -> Result<()> {
        let app = Arc::new(App::new_for_testing()?);

        let temp_dir = tempfile::tempdir()?.into_path();
        let focus_repo = ScratchGitRepo::new_static_fixture(&temp_dir)?;
        let deep_dir = focus_repo.path().join("very").join("deep").join("dir");
        let focus_dir = focus_repo.path().join(".focus");
        std::fs::create_dir_all(&deep_dir)?;
        std::fs::create_dir_all(&focus_dir)?;

        assert_eq!(
            find_repo_root_from(app.clone(), deep_dir)?,
            focus_repo.path().canonicalize()?
        );

        let non_focus_repo = ScratchGitRepo::new_static_fixture(&temp_dir)?;
        if find_repo_root_from(app.clone(), non_focus_repo.path().to_path_buf()).is_ok() {
            bail!("Should not have found a focus repo root in a non-git non-focus repo")
        };

        if find_repo_root_from(app, temp_dir).is_ok() {
            bail!("Should not have found a focus repo root in a non-git non-focus repo")
        };

        Ok(())
    }