Skip to content

Commit

Permalink
test: add some more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
luisdavim committed Jun 2, 2022
1 parent d01fac5 commit 7936a3d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fixtures/quoted.env
Expand Up @@ -9,3 +9,11 @@ OPTION_H="\n"
OPTION_I="some multi-line text
with \"escaped quotes\" and ${OPTION_A} variable"
OPTION_J='some$pecial$1$2!*chars=qweq""e$$\$""'
OPTION_K="
"
OPTION_L="some multi-line text
with \"escaped quotes\"
empty lines

and ${OPTION_A} variable
"
20 changes: 20 additions & 0 deletions gotenv_test.go
Expand Up @@ -200,6 +200,13 @@ THE SOFTWARE.`,
"OPTION_I": `some multi-line text
with "escaped quotes" and 1 variable`,
"OPTION_J": `some$pecial$1$2!*chars=qweq""e$$\$""`,
"OPTION_K": "\n",
"OPTION_L": `some multi-line text
with "escaped quotes"
empty lines
and 1 variable
`,
},
},
{
Expand Down Expand Up @@ -233,6 +240,19 @@ func TestStrictParse(t *testing.T) {
}
}

func TestRead(t *testing.T) {
for _, tt := range fixtures {
env, err := gotenv.Read(tt.filename)
assert.Nil(t, err)

for key, val := range tt.results {
assert.Equal(t, val, env[key])
}

os.Clearenv()
}
}

func TestLoad(t *testing.T) {
for _, tt := range fixtures {
err := gotenv.Load(tt.filename)
Expand Down

0 comments on commit 7936a3d

Please sign in to comment.