diff options
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index d9b5a64..6d581d1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -128,3 +128,31 @@ impl<'a> ConfigBuilder<'a> { } } +#[cfg(test)] +mod tests { + use super::*; + use crate::element::AsConfigElement; + + #[test] + fn test_compile_loading() { + let _c = Config::builder() + .load(&crate::source::test_source::TestSource(|| ConfigElement::Null)) + .unwrap() + .build(); + } + + #[test] + #[cfg(feature = "json")] + fn test_load_json() { + let json: serde_json::Value = serde_json::from_str(r#" + { "key": "value" } + "#).unwrap(); + let json = std::sync::Arc::new(json); + + let _c = Config::builder() + .load(&crate::source::test_source::TestSource(|| json.as_config_element().unwrap())) + .unwrap() + .build(); + } + +} |