MCPcopy Create free account
hub / github.com/a-h/rest / TestGet

Function TestGet

getcomments/parser/parser_test.go:20–92  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18)
19
20func TestGet(t *testing.T) {
21 tests := []struct {
22 name string
23 pkg string
24 expected string
25 }{
26 {
27 name: "private structs are ignored",
28 pkg: "github.com/a-h/rest/getcomments/parser/tests/privatetypes",
29 expected: privatetypes.Expected,
30 },
31 {
32 name: "public structs are included",
33 pkg: "github.com/a-h/rest/getcomments/parser/tests/publictypes",
34 expected: publictypes.Expected,
35 },
36 {
37 name: "string and integer enums are supported",
38 pkg: "github.com/a-h/rest/getcomments/parser/tests/enum",
39 expected: enum.Expected,
40 },
41 {
42 name: "pointers to pointers become a single pointer",
43 pkg: "github.com/a-h/rest/getcomments/parser/tests/pointers",
44 expected: pointers.Expected,
45 },
46 {
47 name: "functions and method receivers are ignored",
48 pkg: "github.com/a-h/rest/getcomments/parser/tests/functions",
49 expected: functions.Expected,
50 },
51 {
52 name: "fields of type channel are ignored",
53 pkg: "github.com/a-h/rest/getcomments/parser/tests/chans",
54 expected: chans.Expected,
55 },
56 {
57 name: "anonymous structs are ignored",
58 pkg: "github.com/a-h/rest/getcomments/parser/tests/anonymous",
59 expected: anonymous.Expected,
60 },
61 {
62 name: "function fields and function types are ignored",
63 pkg: "github.com/a-h/rest/getcomments/parser/tests/functiontypes",
64 expected: functiontypes.Expected,
65 },
66 {
67 name: "stuct, field and constant comments are extracted",
68 pkg: "github.com/a-h/rest/getcomments/parser/tests/docs",
69 expected: docs.Expected,
70 },
71 }
72
73 for _, test := range tests {
74 test := test
75 t.Run(test.name, func(t *testing.T) {
76 m, err := parser.Get(test.pkg)
77 if err != nil {

Callers

nothing calls this directly

Calls 1

GetFunction · 0.92

Tested by

no test coverage detected