Publish harness and TUI open-source
initial sync from the monorepo
This commit is contained in:
commit
c68e39f604
2734 changed files with 1437016 additions and 0 deletions
37
crates/codegen/xai-grok-pager/tests/grok_home_paths.rs
Normal file
37
crates/codegen/xai-grok-pager/tests/grok_home_paths.rs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
//! `GROK_HOME` override tests in an isolated binary so `grok_home()`'s
|
||||
//! process-wide `OnceLock` initializes from the overridden env var.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
fn grok_home_override_path_helpers() {
|
||||
let tmp = tempfile::tempdir().expect("tempdir");
|
||||
let grok_home = tmp.path().to_path_buf();
|
||||
unsafe {
|
||||
std::env::set_var("GROK_HOME", &grok_home);
|
||||
}
|
||||
|
||||
assert_eq!(
|
||||
xai_grok_pager::util::pager_toml_path(),
|
||||
grok_home.join("pager.toml")
|
||||
);
|
||||
assert_eq!(
|
||||
xai_grok_pager::util::display_grok_home_prefix(),
|
||||
"$GROK_HOME"
|
||||
);
|
||||
assert_eq!(
|
||||
xai_grok_pager::util::display_user_grok_path("config.toml"),
|
||||
"$GROK_HOME/config.toml"
|
||||
);
|
||||
|
||||
let memory_path = grok_home.join("memory/MEMORY.md");
|
||||
assert_eq!(
|
||||
xai_grok_pager::util::abbreviate_path(&memory_path.display().to_string()),
|
||||
"$GROK_HOME/memory/MEMORY.md"
|
||||
);
|
||||
|
||||
assert!(xai_grok_pager::util::is_under_user_grok_home(&memory_path));
|
||||
assert!(!xai_grok_pager::util::is_under_user_grok_home(
|
||||
PathBuf::from("/tmp/other").as_path()
|
||||
));
|
||||
}
|
||||
Loading…
Reference in a new issue