mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-22 19:19:09 +00:00
neotest: sort coverage blocks within a test scope
Make the behaviour similar to the `go test` output. It's not a problem for the `go cover` tool, but the sorted file is easier to debug and analize. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
c747bb8ff7
commit
d8e945978a
1 changed files with 11 additions and 0 deletions
|
@ -1,10 +1,12 @@
|
|||
package neotest
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"slices"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
|
@ -201,6 +203,15 @@ func processCover() map[documentName][]*coverBlock {
|
|||
for _, b := range mappedBlocks {
|
||||
blocks = append(blocks, b)
|
||||
}
|
||||
slices.SortFunc(blocks, func(a, b *coverBlock) int {
|
||||
return cmp.Or(
|
||||
cmp.Compare(a.startLine, b.startLine),
|
||||
cmp.Compare(a.endLine, b.endLine),
|
||||
cmp.Compare(a.startCol, b.startCol),
|
||||
cmp.Compare(a.endCol, b.endCol),
|
||||
cmp.Compare(a.stmts, b.stmts),
|
||||
cmp.Compare(a.counts, b.counts))
|
||||
})
|
||||
cover[documentName] = blocks
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue