-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: support comments in multiline input (#16)
Fixes a regression caused by multiline support (#12) Comments are now respected when evaluating quote state
- Loading branch information
Showing
2 changed files
with
72 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
mod common; | ||
use std::env; | ||
|
||
use common::tempdir_with_dotenv; | ||
use dotenvy::dotenv; | ||
|
||
#[test] | ||
fn test_issue_12() { | ||
let _f = tempdir_with_dotenv( | ||
r#" | ||
# Start of .env file | ||
# Comment line with single ' quote | ||
# Comment line with double " quote | ||
# Comment line with double " quote and starts with a space | ||
TESTKEY=test_val # A '" comment | ||
# End of .env file | ||
"#, | ||
) | ||
.expect("should write test env"); | ||
|
||
dotenv().expect("should succeed"); | ||
assert_eq!( | ||
env::var("TESTKEY").expect("test env key not set"), | ||
"test_val" | ||
); | ||
} |