1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-06-23 00:27:49 +02:00
Files
fp-go/option/type_test.go
Dr. Carsten Leue c07df5c771 initial checkin
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
2023-07-07 22:31:06 +02:00

23 lines
360 B
Go

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)
}