-
Notifications
You must be signed in to change notification settings - Fork 6
/
util_test.go
39 lines (30 loc) · 924 Bytes
/
util_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package tuple
import (
"testing"
"github.com/stretchr/testify/require"
)
func Test_typeName_builtin(t *testing.T) {
require.Equal(t, "string", typeName[string]())
}
func Test_typeName_namedStruct(t *testing.T) {
type dummy struct{}
require.Equal(t, "tuple.dummy", typeName[dummy]())
}
func Test_typeName_namedInterface(t *testing.T) {
type dummy interface{}
require.Equal(t, "tuple.dummy", typeName[dummy]())
}
func Test_typeName_unnamedInterface(t *testing.T) {
require.Equal(t, "interface {}", typeName[interface{}]())
}
func Test_typeName_unnamedStruct(t *testing.T) {
require.Equal(t, "struct {}", typeName[struct{}]())
}
func Test_typeName_func(t *testing.T) {
type dummy struct{}
require.Equal(t, "func(interface {}) tuple.dummy", typeName[func(interface{}) dummy]())
}
func Test_typeName_channel(t *testing.T) {
type dummy struct{}
require.Equal(t, "chan tuple.dummy", typeName[chan dummy]())
}