Hunter0x7c7
2022-08-11 a82f9cb69f63aaeba40c024960deda7d75b9fece
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package json_test
 
import (
    "encoding/json"
    "reflect"
    "testing"
)
 
func assertResult(t *testing.T, value map[string]interface{}, expected string) {
    e := make(map[string]interface{})
    err := json.Unmarshal([]byte(expected), &e)
    if err != nil {
        t.Error(err)
    }
    if !reflect.DeepEqual(value, e) {
        bs, _ := json.Marshal(value)
        t.Fatalf("expected:\n%s\n\nactual:\n%s", expected, string(bs))
    }
}