chore: expose codex_home via Config (#941)

This commit is contained in:
Michael Bolin
2025-05-15 00:30:13 -07:00
committed by GitHub
parent 0b9ef93da5
commit 5fc9fc3e3e
10 changed files with 212 additions and 98 deletions

View File

@@ -137,7 +137,8 @@ mod tests {
#![allow(clippy::expect_used, clippy::unwrap_used)]
use super::*;
use crate::config::Config;
use crate::config::ConfigOverrides;
use crate::config::ConfigToml;
use std::fs;
use tempfile::TempDir;
@@ -147,12 +148,19 @@ mod tests {
/// value is cleared to mimic a scenario where no system instructions have
/// been configured.
fn make_config(root: &TempDir, limit: usize, instructions: Option<&str>) -> Config {
let mut cfg = Config::load_default_config_for_test();
cfg.cwd = root.path().to_path_buf();
cfg.project_doc_max_bytes = limit;
let codex_home = TempDir::new().unwrap();
let mut config = Config::load_from_base_config_with_overrides(
ConfigToml::default(),
ConfigOverrides::default(),
codex_home.path().to_path_buf(),
)
.expect("defaults for test should always succeed");
cfg.instructions = instructions.map(ToOwned::to_owned);
cfg
config.cwd = root.path().to_path_buf();
config.project_doc_max_bytes = limit;
config.instructions = instructions.map(ToOwned::to_owned);
config
}
/// AGENTS.md missing should yield `None`.