(fixed) report coverage if script was already compiled
This commit is contained in:
parent
4f6cbff2e1
commit
cd1167a77f
1 changed files with 4 additions and 1 deletions
|
@ -49,6 +49,7 @@ func CompileSource(t testing.TB, sender util.Uint160, src io.Reader, opts *compi
|
|||
// CompileFile compiles a contract from the file and returns its NEF, manifest and hash.
|
||||
func CompileFile(t testing.TB, sender util.Uint160, srcPath string, configPath string) *Contract {
|
||||
if c, ok := contracts[srcPath]; ok {
|
||||
collectCoverage(t, rawCoverage[c.Hash].debugInfo, c.Hash)
|
||||
return c
|
||||
}
|
||||
|
||||
|
@ -90,7 +91,9 @@ func CompileFile(t testing.TB, sender util.Uint160, srcPath string, configPath s
|
|||
|
||||
func collectCoverage(t testing.TB, di *compiler.DebugInfo, h scriptHash) {
|
||||
if isCoverageEnabled() {
|
||||
rawCoverage[h] = &scriptRawCoverage{debugInfo: di}
|
||||
if _, ok := rawCoverage[h]; !ok {
|
||||
rawCoverage[h] = &scriptRawCoverage{debugInfo: di}
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
reportCoverage()
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue