You can use table driven test, see 
https://github.com/golang/go/wiki/TableDrivenTests

On Tuesday, April 23, 2019 at 12:03:15 PM UTC+3, hui zhang wrote:
>
> how to test main function coverage with different args  to  enhance 
> coverage rate
> how to cover the red part ? for you can set args once a time
>
> func Test_main(m *testing.T) {
>    main2()
> }
>
>
> go test -coverprofile coverage.cov -args xxx.conf go tool cover 
> -html=coverage.cov -o coverage.html
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to