Skip to content

Commit

Permalink
Add test cases for GetBoolFlagWithFallback() to env_test.go
Browse files Browse the repository at this point in the history
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
  • Loading branch information
david-wu-octopus committed Oct 11, 2024
1 parent 8d3becc commit 239e10c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions util/config/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,15 @@ func TestFlagWithEqualSign(t *testing.T) {

assert.Equal(t, "bar", GetFlag("foo", ""))
}

func TestBoolFlagWithFallbackUnused(t *testing.T) {
loadOpts(t, "--foo")

assert.True(t, GetBoolFlagWithFallback("foo", false))
}

func TestBoolFlagWithFallbackUsed(t *testing.T) {
loadOpts(t, "--foo")

assert.True(t, GetBoolFlagWithFallback("bar", true))
}

0 comments on commit 239e10c

Please sign in to comment.