From 29b3b63b404c6a2cec28ff5eb067efe0b054a37f Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Sun, 18 Oct 2026 19:33:33 +0200 Subject: add option.Option.Map() --- option/option_test.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'option/option_test.go') diff --git a/option/option_test.go b/option/option_test.go index 43d114e..20782a5 100644 --- a/option/option_test.go +++ b/option/option_test.go @@ -7,6 +7,7 @@ import ( "encoding/json" "fmt" "slices" + "strconv" "testing" "go.xyrillian.de/gg/assert" @@ -74,6 +75,11 @@ func TestIter(t *testing.T) { assert.Equal(t, slices.Collect(Some(42).Iter()), []int{42}) } +func TestMap(t *testing.T) { + assert.Equal(t, None[int]().Map(strconv.Itoa), None[string]()) + assert.Equal(t, Some(42).Map(strconv.Itoa), Some("42")) +} + func TestOr(t *testing.T) { none := None[int]() assert.Equal(t, none.Or(none), None[int]()) -- cgit v1.3.1