在* test.M中记录一行

时间:2018-07-10 19:48:09

标签: go

在以* testing.T或* testing.B作为参数的测试函数中,很容易记录一行:

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

如何在将* testing.M作为参数的设置函数中执行此操作?

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

1 个答案:

答案 0 :(得分:0)

查看package testing的文档,发现类型RelativeLayout.LayoutParams drawBtn = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); drawBtn.addRule(RelativeLayout.CENTER_HORIZONTAL); drawBtn.addRule(RelativeLayout.CENTER_VERTICAL); RelativeLayout.LayoutParams drawUsername = new RelativeLayout.LayoutParams( RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.CENTER_VERTICAL); drawUsername.addRule(RelativeLayout.ABOVE, btn.getId()); drawUsername.addRule(RelativeLayout.CENTER_HORIZONTAL); 没有与之关联的日志记录方法。您应该使用package log进行日志记录(如注释中所述)。