neotest: add a warning to CompileSource, it's bad for coverage

$ go tool cover -html=coverage.txt -o coverage.html
cover: can't read "/home/rik/dev/neo-go/examples/nft-nd-nns/contract.go": open /home/rik/dev/neo-go/examples/nft-nd-nns/contract.go: no such file or directory

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2024-10-09 15:52:25 +03:00
parent 594612bbdf
commit ad41d0f9c7

View file

@ -26,6 +26,10 @@ type Contract struct {
var contracts = make(map[string]*Contract)
// CompileSource compiles a contract from the reader and returns its NEF, manifest and hash.
// Compiled contract will have "contract.go" used for its file name and coverage
// data collection can give wrong results for it, so it's recommended to disable
// coverage ([*Executor.DisableCoverage]) when you're deploying contracts
// compiled via this function.
func CompileSource(t testing.TB, sender util.Uint160, src io.Reader, opts *compiler.Options) *Contract {
// nef.NewFile() cares about version a lot.
config.Version = "neotest"