INNER CODE UNIT · Go
_
openkruise/kruise-game · main_test.go:168
_ = gozap.RedirectStdLog(u)
}
}
buf.Reset()
log.Println("hello")
lines := bytes.Split(bytes.TrimSpace(buf.Bytes()), []byte("\n"))
if len(lines) != 1 {
t.Fatalf("expected single line JSON, got %d lines: %q", len(lines), buf.String())
}
var m map[string]interface{}
if err := json.Unmarshal(lines[0], &m); err != nil {
t.Fatalf("expected JSON log, got %v: %s", err, buf.String())
}
if _, ok := m["code"]; !ok {
t.Fatalf("missing code field")
}
}