Re: [go-nuts] how to test main function coverage with different args

2019-04-24 Thread J. Santos
Hi,

I think you could set the `os.Args` before calling your main.

--
Jota


On Tue, Apr 23, 2019, 6:03 AM 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.
>

-- 
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.


[go-nuts] how to test main function coverage with different args

2019-04-23 Thread hui zhang
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.