MCPcopy Create free account
hub / github.com/copernet/copernicus / TestScriptJsonTests

Function TestScriptJsonTests

logic/lscript/lscript_test.go:131–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

129}
130
131func TestScriptJsonTests(t *testing.T) {
132 data, err := ioutil.ReadFile("test_data/script_tests.json")
133 if err != nil {
134 t.Error(err)
135 return
136 }
137 var tests []interface{}
138 err = json.Unmarshal(data, &tests)
139 if err != nil {
140 t.Error(err)
141 }
142
143 var sec *scriptErrChecker
144 if sec, err = newScriptErrChecker(); err != nil {
145 t.Errorf("error new scriptErrChecker")
146 return
147 }
148 for i, itest := range tests {
149 test, ok := itest.([]interface{})
150 if ok {
151 if err := doScriptJSONTest(t, test, *sec); err != nil {
152 t.Errorf("%dth test error: itest:%#v", i, itest)
153 }
154 } else {
155 t.Errorf("test is not []interface{}")
156 }
157 }
158}
159
160func newScriptErrChecker() (*scriptErrChecker, error) {
161 // Construction of errtable([]string) from errcode/scripterror.go

Callers

nothing calls this directly

Calls 3

newScriptErrCheckerFunction · 0.85
doScriptJSONTestFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected