| 169 | } |
| 170 | |
| 171 | func 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 | |
| 184 | func WriteJson(tb testing.TB, filename string, data interface{}) { |
| 185 | file := filepath.Join("testdata", filename) |