I have a function main() in main.go that does the job. and all other functions below it (i did not include them here). So, when i write tests for all funcs that are included in the main, I can test them OK. But still the code coverage is low because it shows that i did not cover code from my main func.
I know that there is a TestMain func in testing library that should do the job, but i just cannot get how to get it working so that the test covers func main() code.
Below is my main() func which is not covered by tests...
func main() {
c, err := getConfig()
if err != nil {
log.Fatal(err)
}
slideshows, err := getSlideshows(c)
if err != nil {
log.Fatal(err)
}
displaySlideshows(slideshows)
}
Also, i did not find much about it in the internet, so, if this is really a stupid question, please, explain me why this is such a dum problem and where should i search for solutions!
Will much appreciate any help!
Aucun commentaire:
Enregistrer un commentaire