Skip to content

Commit

Permalink
test: added test for #234
Browse files Browse the repository at this point in the history
this makes sure #234 is now implemented.

closes #234
  • Loading branch information
caarlos0 committed Apr 30, 2024
1 parent 0f77fef commit f531b6f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2034,3 +2034,22 @@ func TestIssue304(t *testing.T) {
isNoErr(t, err)
isEqual(t, "https://google.com", cfg.BackendURL)
}

func TestIssue234(t *testing.T) {
type Test struct {
Str string `env:"TEST"`
}
type ComplexConfig struct {
Foo *Test `envPrefix:"FOO_"`
Bar Test `envPrefix:"BAR_"`
Clean *Test
}

t.Setenv("FOO_TEST", "kek")
t.Setenv("BAR_TEST", "lel")

cfg := ComplexConfig{}
isNoErr(t, Parse(&cfg))
isEqual(t, "kek", cfg.Foo.Str)
isEqual(t, "lel", cfg.Bar.Str)
}

0 comments on commit f531b6f

Please sign in to comment.