-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuncinfo_zz_test.go
75 lines (63 loc) · 1.24 KB
/
funcinfo_zz_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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// wrong comment 1
package openapi2
import (
"testing"
// "github.com/go-chai/chai/chai"
"github.com/stretchr/testify/require"
)
//tt - wrong comment 1
func tt(t *testing.T) (int, int) {
//
//
//tt - wrong comment 2
if false {
return 1, 2
}
//tt - correct comment
fn := func() (int, int) { return 3, 4 }; fn2 := func() (int, int) { return 3, 4 }; fn3 := func() (int, int) { return 1, 2 }
type args struct {
fn any
}
type want struct {
comment string
unresolvable bool
}
tests := []struct {
name string
args args
want want
}{
{
name: "fn",
args: args{
fn: fn,
},
want: want{comment: "tt - correct comment\n", unresolvable: false},
},
{
name: "fn2",
args: args{
fn: fn2,
},
want: want{comment: "tt - correct comment\n", unresolvable: false},
},
{
name: "fn3",
args: args{
fn: fn3,
},
want: want{comment: "tt - correct comment\n", unresolvable: false},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// fi := docgen.GetFuncInfo(tt.args.fn)
fi := getFuncInfo(tt.args.fn)
require.Equal(t, tt.want.unresolvable, fi.Unresolvable)
if !tt.want.unresolvable {
require.Equal(t, tt.want.comment, fi.Comment)
}
})
}
return 3, 3
}