pnovotnak
pnovotnak

Reputation: 4581

Logging a Line in *testing.M

In test functions that take *testing.T or *testing.B as a parameter, it's easy to log a line:

func TestMyFunc(t *testing.T) {
    t.Log("hello testing"
    ...
}

How do you do this in a setup function that takes *testing.M as a parameter?

func TestMain(m *testing.M) {
    ???
}

Upvotes: 4

Views: 816

Answers (1)

Daniel Schütte
Daniel Schütte

Reputation: 618

A look at the documentation of package testing shows that type testing.M has no logging method associated with it. You should do logging using package log (as already mentioned in the comments).

Upvotes: 3

Related Questions