(t *testing.T)
| 206 | } |
| 207 | |
| 208 | func TestCreateDoc_FromMap(t *testing.T) { |
| 209 | env := map[string]any{ |
| 210 | "Tweets": []*Tweet{}, |
| 211 | "Config": struct { |
| 212 | MaxSize int |
| 213 | }{}, |
| 214 | "Max": math.Max, |
| 215 | } |
| 216 | Operators = nil |
| 217 | Builtins = nil |
| 218 | doc := CreateDoc(env) |
| 219 | expected := &Context{ |
| 220 | Variables: map[Identifier]*Type{ |
| 221 | "Tweets": { |
| 222 | Kind: "array", |
| 223 | Type: &Type{ |
| 224 | Kind: "struct", |
| 225 | Name: "docgen_test.Tweet", |
| 226 | }, |
| 227 | }, |
| 228 | "Config": { |
| 229 | Kind: "struct", |
| 230 | Fields: map[Identifier]*Type{ |
| 231 | "MaxSize": {Kind: "int"}, |
| 232 | }, |
| 233 | }, |
| 234 | "Max": { |
| 235 | Kind: "func", |
| 236 | Arguments: []*Type{ |
| 237 | {Kind: "float"}, |
| 238 | {Kind: "float"}, |
| 239 | }, |
| 240 | Return: &Type{Kind: "float"}, |
| 241 | }, |
| 242 | }, |
| 243 | Types: map[TypeName]*Type{ |
| 244 | "docgen_test.Tweet": { |
| 245 | Kind: "struct", |
| 246 | Fields: map[Identifier]*Type{ |
| 247 | "Size": {Kind: "int"}, |
| 248 | "Message": {Kind: "string"}, |
| 249 | }, |
| 250 | }, |
| 251 | }, |
| 252 | } |
| 253 | |
| 254 | require.EqualValues(t, expected.Markdown(), doc.Markdown()) |
| 255 | } |
| 256 | |
| 257 | func TestContext_Markdown(t *testing.T) { |
| 258 | doc := CreateDoc(&Env{}) |
nothing calls this directly
no test coverage detected
searching dependent graphs…