use super::super::*;
#[test]
#[cfg(not(feature = "rhh-instrumentation"))]
fn rhh_ac02_default_build_email_match_table_unchanged() {
assert_eq!(header_hint("email"), Some("identity.person.email"));
}
#[test]
#[cfg(not(feature = "rhh-instrumentation"))]
fn rhh_ac02_default_build_phone_substring_unchanged() {
assert_eq!(header_hint("phone"), Some("identity.person.phone_number"));
}
#[test]
#[cfg(not(feature = "rhh-instrumentation"))]
fn rhh_ac02_default_build_zip_geography_unchanged() {
assert_eq!(header_hint("zip"), Some("geography.address.postal_code"));
}
#[test]
#[cfg(not(feature = "rhh-instrumentation"))]
fn rhh_ac02_default_build_env_var_ignored() {
unsafe {
std::env::set_var("RHH_DISABLE_HINTS", "substring_matcher_identity");
}
let result = header_hint("phone");
unsafe {
std::env::remove_var("RHH_DISABLE_HINTS");
}
assert_eq!(result, Some("identity.person.phone_number"));
}
#[test]
#[cfg(feature = "rhh-instrumentation")]
fn rhh_ac02_on_feature_disable_scenarios() {
let prior = std::env::var("RHH_DISABLE_HINTS").ok();
let restore = |prior: &Option<String>| match prior {
Some(v) => unsafe { std::env::set_var("RHH_DISABLE_HINTS", v) },
None => unsafe { std::env::remove_var("RHH_DISABLE_HINTS") },
};
unsafe {
std::env::set_var("RHH_DISABLE_HINTS", "substring_matcher_identity");
}
assert_eq!(
header_hint("phone"),
None,
"disabling substring_matcher_identity should silence phone hint"
);
assert_eq!(
header_hint("ipv6"),
Some("technology.internet.ip_v6"),
"disabling identity must not affect technology"
);
unsafe {
std::env::set_var(
"RHH_DISABLE_HINTS",
"header_hint_table,substring_matcher_identity",
);
}
assert_eq!(
header_hint("email"),
None,
"match_table+identity disable should silence email"
);
unsafe {
std::env::set_var("RHH_DISABLE_HINTS", "");
}
assert_eq!(
header_hint("phone"),
Some("identity.person.phone_number"),
"empty disable list must restore baseline"
);
unsafe {
std::env::set_var("RHH_DISABLE_HINTS", " substring_matcher_identity ,, ,");
}
assert_eq!(
header_hint("phone"),
None,
"whitespace and empty tokens must parse cleanly"
);
restore(&prior);
}