forked from forgejo/forgejo
migrate some more "OptionalBool" to "Option[bool]" (#29479)
just some refactoring bits towards replacing **util.OptionalBool** with **optional.Option[bool]** --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me> (cherry picked from commit f6656181e4a07d6c415927220efa2077d509f7c6) Conflicts: models/repo/repo_list_test.go trivial shared fixture count conflicts
This commit is contained in:
parent
4127fcd608
commit
d3d70198b0
23 changed files with 183 additions and 174 deletions
|
@ -27,6 +27,16 @@ func TestOption(t *testing.T) {
|
|||
assert.Equal(t, int(1), some.Value())
|
||||
assert.Equal(t, int(1), some.ValueOrDefault(2))
|
||||
|
||||
noneBool := optional.None[bool]()
|
||||
assert.False(t, noneBool.Has())
|
||||
assert.False(t, noneBool.Value())
|
||||
assert.True(t, noneBool.ValueOrDefault(true))
|
||||
|
||||
someBool := optional.Some(true)
|
||||
assert.True(t, someBool.Has())
|
||||
assert.True(t, someBool.Value())
|
||||
assert.True(t, someBool.ValueOrDefault(false))
|
||||
|
||||
var ptr *int
|
||||
assert.False(t, optional.FromPtr(ptr).Has())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue