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

Function RunInvalidDSL

expr/testing.go:30–48  ·  view source on GitHub ↗

RunInvalidDSL returns the error resulting from running the given DSL. It is used only in tests.

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

Source from the content-addressed store, hash-verified

28// RunInvalidDSL returns the error resulting from running the given DSL.
29// It is used only in tests.
30func RunInvalidDSL(t *testing.T, dsl func()) error {
31 t.Helper()
32 ResetDSL(t)
33
34 // run DSL (first pass)
35 if !eval.Execute(dsl, nil) {
36 return eval.Context.Errors
37 }
38
39 // run DSL (second pass)
40 if err := eval.RunDSL(); err != nil {
41 return err
42 }
43
44 // expected an error - didn't get one
45 t.Fatal("expected a DSL evaluation error - got none")
46
47 return nil
48}
49
50// CreateTempFile creates a temporary file and writes the given content.
51// It is used only for testing.

Callers 15

TestServiceExprValidateFunction · 0.92
TestErrorExprValidateFunction · 0.92
TestMethodExprValidateFunction · 0.92
TestFilesDSLFunction · 0.92
TestHTTPServiceValidateFunction · 0.92
TestExampleFunction · 0.92

Calls 3

ExecuteFunction · 0.92
RunDSLFunction · 0.92
ResetDSLFunction · 0.85

Tested by 15

TestServiceExprValidateFunction · 0.74
TestErrorExprValidateFunction · 0.74
TestMethodExprValidateFunction · 0.74
TestFilesDSLFunction · 0.74
TestHTTPServiceValidateFunction · 0.74
TestExampleFunction · 0.74