-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils_test.go
More file actions
44 lines (37 loc) · 872 Bytes
/
utils_test.go
File metadata and controls
44 lines (37 loc) · 872 Bytes
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
40
41
42
43
44
package codegen
import (
"reflect"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestGeneratedFileSuffix(t *testing.T) {
cases := []struct {
from string
to string
}{
{
"./main.go",
"./main__generated.go",
},
{
"./main_test.go",
"./main__generated_test.go",
},
}
for _, c := range cases {
require.Equal(t, GeneratedFileSuffix(c.from), c.to)
}
}
func TestIsEmptyValue(t *testing.T) {
tt := require.New(t)
c := make(chan int)
tt.False(IsEmptyValue(reflect.ValueOf(c)))
tt.True(IsEmptyValue(reflect.ValueOf(0)))
tt.True(IsEmptyValue(reflect.ValueOf(float32(0))))
tt.True(IsEmptyValue(reflect.ValueOf("")))
tt.True(IsEmptyValue(reflect.ValueOf(false)))
tt.True(IsEmptyValue(reflect.ValueOf((*int)(nil))))
tt.True(IsEmptyValue(reflect.ValueOf(uint(0))))
tt.True(IsEmptyValue(reflect.ValueOf(time.Time{})))
}