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

Function TestFilesDSL

expr/http_file_server_test.go:11–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestFilesDSL(t *testing.T) {
12 cases := []struct {
13 Name string
14 DSL func()
15 Error string
16 }{
17 {Name: "valid", DSL: testdata.FilesValidDSL},
18 {Name: "incompatible", DSL: testdata.FilesIncompatibleDSL, Error: "invalid use of Files in API files-incompatile"},
19 {Name: "too many arg error", DSL: testdata.FilesTooManyArgErrorDSL, Error: "too many arguments given to Files in API files-too-many-arg-error"},
20 }
21 for _, c := range cases {
22 t.Run(c.Name, func(t *testing.T) {
23 if c.Error == "" {
24 expr.RunDSL(t, c.DSL)
25 } else {
26 err := expr.RunInvalidDSL(t, c.DSL)
27 if !strings.HasSuffix(err.Error(), c.Error) {
28 t.Errorf("got error %q, expected has suffix %q", err.Error(), c.Error)
29 }
30 }
31 })
32 }
33}

Callers

nothing calls this directly

Calls 4

RunDSLFunction · 0.92
RunInvalidDSLFunction · 0.92
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected