MCPcopy Create free account
hub / github.com/chain/txvm / TestMessagef

Function TestMessagef

log/log_test.go:182–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

180}
181
182func TestMessagef(t *testing.T) {
183 buf := new(bytes.Buffer)
184 SetOutput(buf)
185 defer SetOutput(os.Stdout)
186
187 Printf(context.Background(), "test round %d", 0)
188
189 read, err := ioutil.ReadAll(buf)
190 if err != nil {
191 t.Fatal("read buffer error:", err)
192 }
193
194 got := string(read)
195 want := []string{
196 "at=log_test.go:",
197 `message="test round 0"`,
198 }
199
200 for _, w := range want {
201 if !strings.Contains(got, w) {
202 t.Errorf("Result did not contain string:\ngot: %s\nwant: %s", got, w)
203 }
204 }
205}
206
207func TestPrintkvStack(t *testing.T) {
208 buf := new(bytes.Buffer)

Callers

nothing calls this directly

Calls 3

SetOutputFunction · 0.85
PrintfFunction · 0.85
ContainsMethod · 0.80

Tested by

no test coverage detected