vm: add test to check CLI UTF-8 compatibility

This commit is contained in:
AnnaShaleva 2022-02-18 16:27:00 +03:00
parent c182141624
commit c35950206a

View file

@ -206,11 +206,12 @@ func TestLoad(t *testing.T) {
}`
tmpDir := t.TempDir()
t.Run("loadgo", func(t *testing.T) {
filename := filepath.Join(tmpDir, "vmtestcontract.go")
checkLoadgo := func(t *testing.T, tName, cName, cErrName string) {
t.Run("loadgo "+tName, func(t *testing.T) {
filename := filepath.Join(tmpDir, cName)
require.NoError(t, ioutil.WriteFile(filename, []byte(src), os.ModePerm))
filename = "'" + filename + "'"
filenameErr := filepath.Join(tmpDir, "vmtestcontract_err.go")
filenameErr := filepath.Join(tmpDir, cErrName)
require.NoError(t, ioutil.WriteFile(filenameErr, []byte(src+"invalid_token"), os.ModePerm))
filenameErr = "'" + filenameErr + "'"
goMod := []byte(`module test.example/vmcli
@ -229,6 +230,11 @@ go 1.16`)
e.checkNextLine(t, "READY: loaded \\d* instructions")
e.checkStack(t, 8)
})
}
checkLoadgo(t, "simple", "vmtestcontract.go", "vmtestcontract_err.go")
checkLoadgo(t, "utf-8 with spaces", "тестовый контракт.go", "тестовый контракт с ошибкой.go")
t.Run("loadgo, check calling flags", func(t *testing.T) {
srcAllowNotify := `package kek
import "github.com/nspcc-dev/neo-go/pkg/interop/runtime"