From a3551ca3f071488122e76f9dce60d8f0401b9d03 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Wed, 24 Apr 2024 23:13:53 -0300 Subject: [PATCH] test: add a test for #304 refs #304 --- env_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/env_test.go b/env_test.go index e80075e..eb8d08c 100644 --- a/env_test.go +++ b/env_test.go @@ -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) +}