MCPcopy Create free account
hub / github.com/brimdata/super / loadZTestInputsAndOutputs

Function loadZTestInputsAndOutputs

spq_test.go:70–101  ·  view source on GitHub ↗
(ztestDirs map[string]struct{})

Source from the content-addressed store, hash-verified

68}
69
70func loadZTestInputsAndOutputs(ztestDirs map[string]struct{}) (map[string]string, error) {
71 out := map[string]string{}
72 for dir := range ztestDirs {
73 bundles, err := ztest.Load(dir)
74 if err != nil {
75 return nil, err
76 }
77 for _, b := range bundles {
78 if b.Test == nil {
79 continue
80 }
81 testName := b.FileName + "/" + strconv.Itoa(b.Test.Line)
82 if i := b.Test.Input; i != nil && isValid(*i) {
83 out[testName+"/input"] = *i
84 }
85 if o := b.Test.Output; isValid(o) {
86 out[testName+"/output"] = o
87 }
88 for _, i := range b.Test.Inputs {
89 if i.Data != nil && isValid(*i.Data) {
90 out[testName+"/inputs/"+i.Name] = *i.Data
91 }
92 }
93 for _, o := range b.Test.Outputs {
94 if o.Data != nil && isValid(*o.Data) {
95 out[testName+"/outputs/"+o.Name] = *o.Data
96 }
97 }
98 }
99 }
100 return out, nil
101}
102
103// isValid returns true if and only if s can be read fully without error by
104// anyio and contains at least one value.

Callers 1

TestSPQFunction · 0.85

Calls 2

LoadFunction · 0.92
isValidFunction · 0.85

Tested by

no test coverage detected