From 6b15c76e23dab00ddf85e233a48b271d66f8c16f Mon Sep 17 00:00:00 2001 From: fdai7451 Date: Sat, 21 Jan 2023 18:32:34 +0100 Subject: [PATCH] test: add env variable resolve test --- src/preprocess.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/preprocess.rs b/src/preprocess.rs index 350b909..6ea4127 100644 --- a/src/preprocess.rs +++ b/src/preprocess.rs @@ -41,4 +41,15 @@ mod tests { assert_eq!(preprocess("key=value".to_string()), Ok(None)); 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()))) + } }