Expand description
Testing utilities for overriding option values in tests.
§Example
ⓘ
use sentry_options::Options;
use sentry_options::testing::override_options;
use serde_json::json;
#[test]
fn test_feature() {
let opts = Options::from_directory(test_dir).unwrap();
let _guard = override_options(&[("seer", "feature.enabled", json!(true))]).unwrap();
assert_eq!(opts.get("seer", "feature.enabled").unwrap(), json!(true));
}Structs§
- Override
Guard - Guard that restores overrides when dropped.
Functions§
- clear_
override - Clear an override for a specific namespace and key.
- ensure_
initialized - Initialize options, ignoring “already initialized” errors.
- get_
override - Get an override value if one exists.
- override_
options - Set overrides for the lifetime of the returned guard.
- set_
override - Set an override value for a specific namespace and key.