Skip to content

Commit

Permalink
Use t.Setenv instead of os.Setenv in test
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Jun 2, 2023
1 parent aa9a669 commit fbedb88
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions flag_value_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import (

func TestEnvSource(t *testing.T) {

os.Setenv("foo", "bar")
defer os.Unsetenv("foo")
t.Setenv("foo", "bar")

s := EnvSource("foo_1")
_, ok := s.Get()
Expand All @@ -20,8 +19,7 @@ func TestEnvSource(t *testing.T) {
expect(t, ok, true)
expect(t, str, "bar")

os.Setenv("myfoo", "mybar")
defer os.Unsetenv("myfoo")
t.Setenv("myfoo", "mybar")

source := EnvVars("foo1", "myfoo")
str, id, ok := source.Get()
Expand Down

0 comments on commit fbedb88

Please sign in to comment.