MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestDebug

Function TestDebug

libs/log/tm_logger_test.go:46–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func TestDebug(t *testing.T) {
47 var bufDebug bytes.Buffer
48
49 ld := log.NewTMLogger(&bufDebug)
50 ld.Debug("Client initialized with old header (trusted is more recent)",
51 "old", 42,
52 "trustedHeight", "forty two",
53 "trustedHash", []byte("test me"))
54
55 msg := strings.TrimSpace(bufDebug.String())
56
57 // Remove the timestamp information to allow
58 // us to test against the expected message.
59 receivedmsg := strings.Split(msg, "] ")[1]
60
61 const expectedmsg = `Client initialized with old header
62 (trusted is more recent) old=42 trustedHeight="forty two"
63 trustedHash=74657374206D65`
64 if strings.EqualFold(receivedmsg, expectedmsg) {
65 t.Fatalf("received %s, expected %s", receivedmsg, expectedmsg)
66 }
67}
68
69func TestError(t *testing.T) {
70 var bufErr bytes.Buffer

Callers

nothing calls this directly

Calls 3

NewTMLoggerFunction · 0.92
DebugMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected