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

Function initDSL

codegen/service/testing.go:13–24  ·  view source on GitHub ↗

initDSL initializes the DSL environment and returns the root.

(t *testing.T)

Source from the content-addressed store, hash-verified

11
12// initDSL initializes the DSL environment and returns the root.
13func initDSL(t *testing.T) *expr.RootExpr {
14 // reset all roots and codegen data structures
15 eval.Reset()
16 expr.Root = new(expr.RootExpr)
17 expr.GeneratedResultTypes = new(expr.ResultTypesRoot)
18 expr.Root.API = expr.NewAPIExpr("test api", func() {})
19 expr.Root.API.Servers = []*expr.ServerExpr{expr.Root.API.DefaultServer()}
20 root := expr.Root
21 require.NoError(t, eval.Register(root))
22 require.NoError(t, eval.Register(expr.GeneratedResultTypes))
23 return root
24}
25
26// runDSL returns the DSL root resulting from running the given DSL.
27func runDSL(t *testing.T, dsl func()) *expr.RootExpr {

Callers 2

runDSLFunction · 0.85
runDSLWithErrorFunction · 0.85

Calls 4

ResetFunction · 0.92
NewAPIExprFunction · 0.92
RegisterFunction · 0.92
DefaultServerMethod · 0.80

Tested by

no test coverage detected