MCPcopy Create free account
hub / github.com/Percona-Lab/mysql_random_data_load / LoadJson

Function LoadJson

testutils/testutils.go:171–182  ·  view source on GitHub ↗
(tb testing.TB, filename string, dest interface{})

Source from the content-addressed store, hash-verified

169}
170
171func LoadJson(tb testing.TB, filename string, dest interface{}) {
172 file := filepath.Join("testdata", filename)
173 data, err := ioutil.ReadFile(file)
174 if err != nil {
175 fmt.Printf("%s cannot load json file %q: %s\n\n", caller(), file, err)
176 }
177
178 err = json.Unmarshal(data, dest)
179 if err != nil {
180 fmt.Printf("%s cannot unmarshal the contents of %q into %T: %s\n\n", caller(), file, dest, err)
181 }
182}
183
184func WriteJson(tb testing.TB, filename string, data interface{}) {
185 file := filepath.Join("testdata", filename)

Callers

nothing calls this directly

Calls 1

callerFunction · 0.85

Tested by

no test coverage detected