如何通过 gomock 使用 Go 可测试示例

问题描述 投票:0回答:1

我想使用 gomock 进行 go 示例测试,我该怎么做?

func Example_getCorrectForm(){
    ctrl := gomock.NewController(t) <----------- How to get this *testing.T
    defer ctrl.finish()
    
    // use ctrl and mock some services and use them

   fmt.Println(<output stringified json >)
   //Output: 
   //<my expected stringified json output goes here>
}
unit-testing go go-testing
1个回答
0
投票

如何通过 gomock 使用 Go 可测试示例

你根本做不到。

© www.soinside.com 2019 - 2024. All rights reserved.