Skip to content

Commit

Permalink
test: add tests for #266
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed May 12, 2023
1 parent 0b4d8a6 commit bf36115
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,8 @@ func TestHook(t *testing.T) {
type config struct {
Something string `env:"SOMETHING" envDefault:"important"`
Another string `env:"ANOTHER"`
Nope string
Inner struct{} `envPrefix:"FOO_"`
}

cfg := &config{}
Expand Down Expand Up @@ -1325,6 +1327,8 @@ func ExampleParse_onSet() {
Home string `env:"HOME,required"`
Port int `env:"PORT" envDefault:"3000"`
IsProduction bool `env:"PRODUCTION"`
NoEnvTag bool
Inner struct{} `envPrefix:"INNER_"`
}
os.Setenv("HOME", "/tmp/fakehome")
var cfg config
Expand All @@ -1339,7 +1343,7 @@ func ExampleParse_onSet() {
// Output: Set HOME to /tmp/fakehome (default? false)
// Set PORT to 3000 (default? true)
// Set PRODUCTION to (default? false)
// {Home:/tmp/fakehome Port:3000 IsProduction:false}
// {Home:/tmp/fakehome Port:3000 IsProduction:false NoEnvTag:false Inner:{}}
}

func ExampleParse_defaults() {
Expand Down

0 comments on commit bf36115

Please sign in to comment.