mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-10-16 05:43:24 +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
8e650c752a
1 changed files with 22 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"slices"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
|
@ -201,6 +202,27 @@ func processCover() map[documentName][]*coverBlock {
|
|||
for _, b := range mappedBlocks {
|
||||
blocks = append(blocks, b)
|
||||
}
|
||||
slices.SortFunc(blocks, func(a, b *coverBlock) int {
|
||||
if a.startLine != b.startLine {
|
||||
return int(a.startLine - b.startLine)
|
||||
}
|
||||
if a.endLine != b.endLine {
|
||||
return int(a.endLine - b.endLine)
|
||||
}
|
||||
if a.startCol != b.startCol {
|
||||
return int(a.startCol - b.startCol)
|
||||
}
|
||||
if a.endCol != b.endCol {
|
||||
return int(a.endCol - b.endCol)
|
||||
}
|
||||
if a.stmts != b.stmts {
|
||||
return int(a.stmts - b.stmts)
|
||||
}
|
||||
if a.counts != b.counts {
|
||||
return int(a.counts - b.counts)
|
||||
}
|
||||
return 0
|
||||
})
|
||||
cover[documentName] = blocks
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue