mirror of
https://github.com/Steffo99/micronfig.git
synced 2024-11-25 01:24:18 +00:00
18 lines
385 B
Rust
18 lines
385 B
Rust
|
use std::env;
|
||
|
|
||
|
micronfig::required!(PLAYER_NAME, String);
|
||
|
micronfig::required!(PLAYER_ID, u64);
|
||
|
micronfig::optional!(IS_SUS, bool);
|
||
|
|
||
|
|
||
|
#[test]
|
||
|
fn test_macros() {
|
||
|
env::set_var("PLAYER_NAME", "Steffo");
|
||
|
env::set_var("PLAYER_ID", "1234");
|
||
|
env::remove_var("IS_SUS");
|
||
|
|
||
|
assert_eq!(*PLAYER_NAME, "Steffo");
|
||
|
assert_eq!(*PLAYER_ID, 1234u64);
|
||
|
assert_eq!(*IS_SUS, None);
|
||
|
}
|