草庐IT

unit-testing - 使用gocheck测试go(golang)代码,suite功能如何使用?

我正在尝试使用gocheck测试我的代码。我用以下示例(类似于他们网站提供的示例)指导自己:packagehello_testimport("testing"gocheck"gopkg.in/check.v1")//Hookupgocheckintothe"gotest"runner.funcTest(t*testing.T){gocheck.TestingT(t)}typeMySuitestruct{}//但是,即使阅读了文档,我也不确定是否理解某些行。为什么需要行typeMySuitestruct{}甚至更有趣的行,为什么需要var_=gocheck.Suite(&MySuite{

unit-testing - 使用gocheck测试go(golang)代码,suite功能如何使用?

我正在尝试使用gocheck测试我的代码。我用以下示例(类似于他们网站提供的示例)指导自己:packagehello_testimport("testing"gocheck"gopkg.in/check.v1")//Hookupgocheckintothe"gotest"runner.funcTest(t*testing.T){gocheck.TestingT(t)}typeMySuitestruct{}//但是,即使阅读了文档,我也不确定是否理解某些行。为什么需要行typeMySuitestruct{}甚至更有趣的行,为什么需要var_=gocheck.Suite(&MySuite{