go-scopes/tests/funky_test.go

21 lines
436 B
Go

package scopes_test
import (
tbase "testing"
"git.sr.ht/~cco/go-scopes/lib/funky"
"git.sr.ht/~cco/go-scopes/testing"
)
func TestFunky(tb *tbase.T) {
t := testing.SetUp(tb)
t.Run("maybe", MaybeTest)
}
func MaybeTest(t *testing.T) {
var i0 funky.Maybe[int] = funky.Nothing[int]()
t.AssertEqual(i0.IsNothing(), true)
var i1 funky.Maybe[int] = funky.Just(3)
t.AssertEqual(i1.IsNothing(), false)
t.AssertEqual(i1.Value(), 3)
}