Hi.
There is a small issue with the go cover tool, when using multiple expressions in a case expression.
As an example, when testing the following function:
func foo(x int) {
switch x {
case 1, 2, 3, 5, 7:
...
case 2:
...
}
}
A call to foo(1) will cause the entire line of the `case 1, 2, 3, 5, 7`expression to be highlighted, in the HTML page generated by go cover.
This is bad, since I can not tell if all the cases are covered.
This is not an issue with switch case, but an issue when multiple statements are on the same line.
Is this a limitation of the UI or a limitation of the coverage algorithm?
In general multi line statements are allowed by the grammar, but reformatted by go fmt, as an example:
func foo() {
if true { fmt.Println("true") } else { fmt.Println("false") }
}
So, if this is only an issue with the UI, I hope that a special case can be made to handle the switch statement.
Thanks Manlio