Add a full fixture for comments for extra piece of mind

This commit is contained in:
John Barton
2023-01-27 13:00:16 +11:00
parent 08d75deb23
commit 02a6516148
2 changed files with 15 additions and 0 deletions

4
fixtures/comments.env Normal file
View File

@ -0,0 +1,4 @@
# Full line comment
foo=bar # baz
bar=foo#baz
baz="foo"#bar

View File

@ -461,6 +461,17 @@ func TestErrorParsing(t *testing.T) {
}
}
func TestComments(t *testing.T) {
envFileName := "fixtures/comments.env"
expectedValues := map[string]string{
"foo": "bar",
"bar": "foo#baz",
"baz": "foo",
}
loadEnvAndCompareValues(t, Load, envFileName, expectedValues, noopPresets)
}
func TestWrite(t *testing.T) {
writeAndCompare := func(env string, expected string) {
envMap, _ := Unmarshal(env)