Skip to main content

create_test_config_service

Macro create_test_config_service 

Source
macro_rules! create_test_config_service {
    ($service_name:ident, $config_builder:expr) => { ... };
}
Expand description

All twelve #[macro_export] configuration test macros, re-exported from the subx-core crate.

#[macro_export] places a macro at its defining crate’s root, so pub use subx_core::config; above cannot reach them; they are listed individually. Legacy re-exports for consumers that have not yet migrated to subx_core:: paths, and will be removed once they have. Create a temporary test configuration service for use in test functions.

This macro creates a configuration service variable that can be used throughout a test function.

§Examples

use subx_core::create_test_config_service;

fn my_test() {
    create_test_config_service!(service, TestConfigBuilder::new().with_ai_provider("openai"));
     
    let config = service.get_config().unwrap();
    assert_eq!(config.ai.provider, "openai");
}