macro_rules! test_production_config_with_env {
($env_vars:expr, $test:expr) => { ... };
}Expand description
Execute ProductionConfigService tests with specified environment variable mapping.
This macro creates a TestEnvironmentProvider, sets the specified environment variables, then uses that provider to create a ProductionConfigService for testing.
§Arguments
$env_vars- Environment variable mapping expression (HashMap<&str, &str>)$test- Test closure that receives a ProductionConfigService reference
§Examples
ⓘ
use subx_cli::{test_production_config_with_env, std::collections::HashMap};
let env_vars = [
("OPENAI_API_KEY", "sk-test-key"),
("OPENAI_BASE_URL", "https://test.api.com/v1")
].iter().cloned().collect::<HashMap<_, _>>();
test_production_config_with_env!(env_vars, |service| {
let config = service.get_config().unwrap();
assert_eq!(config.ai.api_key, Some("sk-test-key".to_string()));
assert_eq!(config.ai.base_url, "https://test.api.com/v1");
});