mirror of
https://github.com/OMGeeky/confique.git
synced 2026-02-23 15:38:30 +01:00
19
tests/env.rs
Normal file
19
tests/env.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use serde::Deserialize;
|
||||
use confique::{Config};
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
enum Foo { A, B, C }
|
||||
|
||||
|
||||
#[test]
|
||||
fn enum_env() {
|
||||
#[derive(Config)]
|
||||
struct Conf {
|
||||
#[config(env = "FOO")]
|
||||
foo: Foo,
|
||||
}
|
||||
|
||||
std::env::set_var("FOO", "B");
|
||||
let conf = Conf::builder().env().load();
|
||||
assert!(matches!(conf, Ok(Conf { foo: Foo::B })));
|
||||
}
|
||||
Reference in New Issue
Block a user