Browse Source

test: add env variable resolve test

main
fdai7451 2 years ago
parent
commit
8989ae7a65
  1. 11
      src/preprocess.rs

11
src/preprocess.rs

@ -41,4 +41,15 @@ mod tests {
assert_eq!(preprocess("key=value".to_string()), Ok(None)); assert_eq!(preprocess("key=value".to_string()), Ok(None));
assert_eq!(env::var("key").unwrap_or_default(), "value".to_string()) assert_eq!(env::var("key").unwrap_or_default(), "value".to_string())
} }
#[test]
fn test_preprocessing_resolve_env_variable() {
assert_eq!(preprocess("key=value".to_string()), Ok(None));
assert_eq!(preprocess("$key".to_string()), Ok(Some("value".to_string())))
}
#[test]
fn test_preprocessing_resolve_non_existent_env_variable() {
assert_eq!(preprocess("$nonexitent".to_string()), Ok(Some("".to_string())))
}
} }
Loading…
Cancel
Save