Skip to content

Commit

Permalink
Explain present check for floats
Browse files Browse the repository at this point in the history
  • Loading branch information
bittersweet committed May 24, 2016
1 parent dfd038f commit 70296c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ func present(str interface{}) bool {
case bool:
return t == true
}

// If it was not nil, a blank string or false, we can assume it's present.
return true
}

Expand Down
1 change: 1 addition & 0 deletions notifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ func TestPresent(t *testing.T) {
assert.False(t, present(false))
assert.True(t, present("not blank"))
assert.True(t, present(true))
assert.True(t, present(0.1))
}

func TestEq(t *testing.T) {
Expand Down

0 comments on commit 70296c8

Please sign in to comment.