Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcl committed Aug 29, 2024
1 parent d5a9a88 commit c951c1f
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ func TestParseEnvVars(t *testing.T) {
err error
}{
{
name: "Simple Key-Value",
envStr: "KEY=VALUE\nANOTHER_KEY=VALUE",
expected: map[string]string{"KEY": "VALUE", "ANOTHER_KEY": "VALUE"},
name: "Simple Key-Value",
envStr: `KEY=VALUE
ANOTHER_KEY=VALUE2
KEY3="VALUE1 VALUE2"`,
expected: map[string]string{"KEY": "VALUE", "ANOTHER_KEY": "VALUE2", "KEY3": "VALUE1 VALUE2"},
},
{
name: "Export Prefix",
Expand Down Expand Up @@ -66,6 +68,19 @@ ANOTHER_KEY='VALUE'
'ANOTHER_KEY'=VALUE`,
err: &DotenvParseError{Line: 2},
},
{
name: "Value with Spaces",
envStr: `KEY="VALUE"
KEY2=VALUE 2`,
err: &DotenvParseError{Line: 2},
},
{
name: "Empty Line",
envStr: `KEY="VALUE"
KEY2=VALUE2`,
expected: map[string]string{"KEY": "VALUE", "KEY2": "VALUE2"},
},
}

for _, tt := range tests {
Expand Down

0 comments on commit c951c1f

Please sign in to comment.