1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-06-25 00:36:54 +02:00
Files
fp-go/option/type_test.go

23 lines
360 B
Go
Raw Normal View History

package option
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestTypeConversion(t *testing.T) {
var src any = "Carsten"
dst := ToType[string](src)
assert.Equal(t, Some("Carsten"), dst)
}
func TestInvalidConversion(t *testing.T) {
var src any = make(map[string]string)
dst := ToType[int](src)
assert.Equal(t, None[int](), dst)
}