mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 01:18:21 +00:00
test that proved hook has access to PATH (#1967)
This commit is contained in:
parent
91242e574a
commit
83df6ddbc8
1 changed files with 24 additions and 0 deletions
|
|
@ -340,6 +340,30 @@ exit 1
|
||||||
assert!(res != HookResult::Ok);
|
assert!(res != HookResult::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_env_containing_path() {
|
||||||
|
let (_td, repo) = repo_init().unwrap();
|
||||||
|
let root = repo.path().parent().unwrap();
|
||||||
|
let repo_path: &RepoPath =
|
||||||
|
&root.as_os_str().to_str().unwrap().into();
|
||||||
|
|
||||||
|
let hook = b"#!/bin/sh
|
||||||
|
export
|
||||||
|
exit 1
|
||||||
|
";
|
||||||
|
|
||||||
|
create_hook(repo_path, HOOK_PRE_COMMIT, hook);
|
||||||
|
let res = hooks_pre_commit(repo_path).unwrap();
|
||||||
|
|
||||||
|
let HookResult::NotOk(out) = res else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
|
|
||||||
|
assert!(out
|
||||||
|
.lines()
|
||||||
|
.any(|line| line.starts_with("export PATH")));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pre_commit_fail_hookspath() {
|
fn test_pre_commit_fail_hookspath() {
|
||||||
let (_td, repo) = repo_init().unwrap();
|
let (_td, repo) = repo_init().unwrap();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue