Skip to content

Commit

Permalink
Merge branch 'release/0.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmmn378 committed Feb 19, 2024
2 parents be173c0 + 514e237 commit 076540e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/dotenv_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ fn remove_comments(text: &str) -> String {
fn generate_dotenv_string(env: IndexMap<String, String>) -> Result<String> {
let mut env_string = String::new();
for (key, val) in env {
let val = val.trim();
let val_type = get_type(&val);
env_string.push_str(&format!("{}={}\n", key, val_type));
}
Expand Down Expand Up @@ -107,8 +108,9 @@ mod tests {
let mut env = IndexMap::new();
env.insert("HELLO".to_string(), "ADELE".to_string());
env.insert("WORLD".to_string(), "21".to_string());
env.insert("AVAILABLE".to_string(), " true".to_string());
let env_string = generate_dotenv_string(env).unwrap();
assert_eq!(env_string, "HELLO=string\nWORLD=int");
assert_eq!(env_string, "HELLO=string\nWORLD=int\nAVAILABLE=bool");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/test.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TAYLOR="SWIFT"
AGE=25
SCORE=99.9 # Comment
# Some Comment
ACTIVE =true
ACTIVE = true

#

Expand Down

0 comments on commit 076540e

Please sign in to comment.