MCPcopy Create free account
hub / github.com/goadesign/goa / RunDSL

Function RunDSL

codegen/testing.go:16–28  ·  view source on GitHub ↗

RunDSL returns the DSL root resulting from running the given DSL.

(t *testing.T, dsl func())

Source from the content-addressed store, hash-verified

14
15// RunDSL returns the DSL root resulting from running the given DSL.
16func RunDSL(t *testing.T, dsl func()) *expr.RootExpr {
17 t.Helper()
18 eval.Reset()
19 expr.Root = new(expr.RootExpr)
20 expr.GeneratedResultTypes = new(expr.ResultTypesRoot)
21 require.NoError(t, eval.Register(expr.Root))
22 require.NoError(t, eval.Register(expr.GeneratedResultTypes))
23 expr.Root.API = expr.NewAPIExpr("test api", func() {})
24 expr.Root.API.Servers = []*expr.ServerExpr{expr.Root.API.DefaultServer()}
25 require.True(t, eval.Execute(dsl, nil), eval.Context.Error())
26 require.NoError(t, eval.RunDSL())
27 return expr.Root
28}
29
30// SectionCode generates and formats the code for the given section.
31func SectionCode(t *testing.T, section *SectionTemplate) string {

Callers 15

TestExampleServerFilesFunction · 0.92
TestExampleCLIFilesFunction · 0.92
TestBuildBodyTypesFunction · 0.92
TestMapTypesFunction · 0.92
TestBuildOperationFunction · 0.92
TestBuildOperationIDFunction · 0.92
TestExampleServerFilesFunction · 0.92

Calls 7

ResetFunction · 0.92
RegisterFunction · 0.92
NewAPIExprFunction · 0.92
ExecuteFunction · 0.92
RunDSLFunction · 0.92
DefaultServerMethod · 0.80
ErrorMethod · 0.45

Tested by 15

TestExampleServerFilesFunction · 0.74
TestExampleCLIFilesFunction · 0.74
TestBuildBodyTypesFunction · 0.74
TestMapTypesFunction · 0.74
TestBuildOperationFunction · 0.74
TestBuildOperationIDFunction · 0.74
TestExampleServerFilesFunction · 0.74