Skip to content

Commit

Permalink
test: add a test for #304
Browse files Browse the repository at this point in the history
refs #304
  • Loading branch information
caarlos0 committed Apr 25, 2024
1 parent 1e2d9e1 commit a3551ca
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions env_test.go
Expand Up @@ -2013,3 +2013,15 @@ func TestBase64Password(t *testing.T) {
isEqual(t, "admin", c.Username)
isEqual(t, "admin123", string(*c.Password))
}

func TestIssue304(t *testing.T) {
t.Setenv("BACKEND_URL", "https://google.com")
type Config struct {
BackendURL string `envDefault:"localhost:8000"`
}
cfg, err := ParseAsWithOptions[Config](Options{
UseFieldNameByDefault: true,
})
isNoErr(t, err)
isEqual(t, "https://google.com", cfg.BackendURL)
}

0 comments on commit a3551ca

Please sign in to comment.