Skip to content

Commit

Permalink
Extends multi-line integration-test
Browse files Browse the repository at this point in the history
  • Loading branch information
hoijui committed Feb 27, 2022
1 parent f8de4f3 commit a7f7d60
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion dotenv/tests/test-multiline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,30 @@ use crate::common::*;
fn test_multiline() {
let value = "-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----\\n\\\"QUOTED\\\"";
let weak = "-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----\n\"QUOTED\"";
let dir = tempdir_with_dotenv(&format!("WEAK=\"{}\"\nSTRONG='{}'", value, value)).unwrap();
let dir = tempdir_with_dotenv(&format!(r#"
KEY=my\ cool\ value
KEY3="awesome stuff \"mang\"
more
on other
lines"
KEY4='hello '\''fds'"
good ' \'morning"
WEAK="{}"
STRONG='{}'
"#,
value,
value)
)
.unwrap();

dotenv().ok();
assert_eq!(var("KEY").unwrap(), r#"my cool value"#);
assert_eq!(var("KEY3").unwrap(), r#"awesome stuff "mang"
more
on other
lines"#);
assert_eq!(var("KEY4").unwrap(), r#"hello 'fds
good ' 'morning"#);
assert_eq!(var("WEAK").unwrap(), weak);
assert_eq!(var("STRONG").unwrap(), value);

Expand Down

0 comments on commit a7f7d60

Please sign in to comment.